home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / language / asa / readme < prev    next >
Text File  |  1994-10-23  |  93KB  |  2,773 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.              ADAPTIVE SIMULATED ANNEALING (ASA) (C)
  8.  
  9.  
  10.  
  11.                           Lester Ingber
  12.  
  13.                      Lester Ingber Research
  14.                           P.O. Box 857
  15.                         McLean, VA 22101
  16.  
  17.                     ingber@alumni.caltech.edu
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  71.  
  72.  
  73. 1.  GNU General Public License (GPL)
  74.  
  75.      This  Adaptive  Simulated Annealing (ASA) code is being made
  76. available under a GNU COPYING "copyleft" license, and is owned by
  77. Lester Ingber[1].  Please read the copy of this license contained
  78. in this directory.  Its intent is  to  make  this  code  publicly
  79. available  to the widest audience while maintaining the integrity
  80. of the basic algorithm.
  81.  
  82. 2.  Documentation
  83.  
  84.  
  85. 2.1.  Table of Contents
  86.  
  87.      A Table of Contents of the  three  levels  of  headers  with
  88. their  page numbers is located at the end of this document.  This
  89. may be placed after the first title page, or left at the end  for
  90. quick reference.
  91.  
  92. 2.2.  readme.ms
  93.  
  94.      The  readme.ms  file  is used to prepare other documentation
  95. files using UNIX(R) MS macros.
  96.  
  97. 2.3.  README and README+
  98.  
  99.      README is an ASCII file that can be previewed on your screen
  100. or sent to an ASCII lineprinter.
  101.  
  102.      README+   is   README  without  any  filters  to  strip  off
  103. underlining and bold enhancements.  This is uuencoded to the file
  104. README+.uu  in  order  to  pass through the shar utility.  If you
  105. have  downloaded  ASA-shar  or  ASA-shar.Z,  to  use  this  file,
  106. `uudecode README+.uu` will leave README+.
  107.  
  108. 2.4.  asa.[13nl] Manpage
  109.  
  110.      The  README  or  README+  file can be copied to a file named
  111. asa.[l3], and asa.[13] can be installed as MANPATH/cat1/asa.1  or
  112. MANPATH/cat3/asa.3, where MANPATH is the place your man directory
  113. is located.  If you do not have any cat[13] directories  on  your
  114. system,   then   installing  a  copy  of  README  or  README+  as
  115. MANPATH/man[13nl]/asa.[13nl], choosing one  of  the  suffixes  in
  116. [13nl]  for  your  choice  of directory and asa file name, should
  117. work fine on most machines.  (However, passing  asa.[13nl]  which
  118. is  the  equivalent  of  README[+] through man may strip out some
  119. items like \"asa_out\".)   You  likely  can  avoid  some  further
  120. undesirable  formatting by man by placing '.nf' on the first line
  121. of this file.
  122.  
  123. 2.5.  README.ps
  124.  
  125.      README.ps is a PostScript(R) formatted  file  which  may  be
  126. previewed  on  your screen if you have the proper software, or it
  127.  
  128.  
  129.  
  130.                               - 1 -
  131.  
  132.  
  133.  
  134.  
  135.  
  136. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  137.  
  138.  
  139. may be sent to a PostScript(R) printer to produce hardcopy.
  140.  
  141. 2.6.  Additional Documentation
  142.  
  143.      CHANGES is a terse record of major changes made in  the  ASA
  144. code.    NOTES  is  a  collection  of  recommended  enhancements,
  145. modifications,  comments,  caveats,  etc.,  that  might   be   of
  146. interest.
  147.  
  148.      The file asa_new in ftp.alumni.caltech.edu: /pub/ingber is a
  149. list of major changes in ASA since the last announcement  to  the
  150. ASA_list.   This can be used as a quick guide to determine if you
  151. should download the latest ASA code in  the  archive  before  the
  152. next announcement.
  153.  
  154.      An   addendum   to   NOTES   is   the   file  asa_papers  in
  155. ftp.alumni.caltech.edu:  /pub/ingber,  listing  some  (p)reprints
  156. that  have  used  ASA  or its precursor VFSR.  This separation of
  157. information is to minimize updating versions of the ASA directory
  158. due to changes in this section.
  159.  
  160.      It  is  certain  that  there  is much research to be done on
  161. determining optimal or even reasonable ASA parameters, e.g.,  the
  162. set  of  Program  Options,  for  different  classes  of  systems,
  163. especially in higher dimensional spaces of user parameters.   (In
  164. the  NOTES  file  are  some  comments  on  how  you might use ASA
  165. recursively to determine the optimal set of some Program  Options
  166. for  a  given  system.)   A  major  purpose  of  making this code
  167. publicly available is to motivate more of this research, and thus
  168. make the code more useful to a wider audience.
  169.  
  170. 2.7.  Parallelizing ASA and PATHINT Project (PAPP)
  171.  
  172.      The  file  /pub/ingber/MISC.DIR/parallel.txt   contains   an
  173. update  of  the Parallelizing ASA and PATHINT Project (PAPP).  No
  174. code will be released until it has passed some  reasonable  tests
  175. and has reasonable documentation.
  176.  
  177. 2.8.  Additional Information
  178.  
  179.      Sorry, I cannot assume the task of mailing out hardcopies of
  180. code or papers.   My volunteer time assisting people  with  their
  181. queries on my codes and papers must be limited to electronic mail
  182. correspondence.  Commercial consulting appointments can  be  made
  183. by contacting me via e-mail, mail, or calling 1.800.L.INGBER.
  184.  
  185. 3.  Availability of ASA Code
  186.  
  187.  
  188. 3.1.  Caltech
  189.  
  190.      The  latest Adaptive Simulated Annealing (ASA) code and some
  191. related (p)reprints can  be  retrieved  via  anonymous  ftp  from
  192. ftp.alumni.caltech.edu   [131.215.139.234]   in  the  /pub/ingber
  193.  
  194.  
  195.  
  196.                               - 2 -
  197.  
  198.  
  199.  
  200.  
  201.  
  202. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  203.  
  204.  
  205. directory.  This archive  also  can  be  accessed  via  WWW  path
  206. http://alumni.caltech.edu/~ingber/                             or
  207. ftp://ftp.alumni.caltech.edu/pub/ingber/.
  208.  
  209.      Interactively [brackets signify machine prompts]:
  210.         [your_machine%] ftp ftp.alumni.caltech.edu
  211.         [Name (...):] anonymous
  212.         [Password:] your_e-mail_address
  213.         [ftp>] cd pub/ingber
  214.         [ftp>] binary
  215.         [ftp>] ls
  216.         [ftp>] get file_of_interest
  217.         [ftp>] quit
  218. The 00index file  contains  an  index  of  the  other  files  and
  219. information  on  getting  gzip  and  unshar  for  DOS(R), MAC(R),
  220. UNIX(R), and VMS(R) systems.
  221.  
  222.      The latest version of ASA, ASA-x.y  (x  and  y  are  version
  223. numbers),  can  be  obtained in several formats.  ASA-shar.Z is a
  224. compress'd shar'd file of the current code.  For the  convenience
  225. of  users who do not have any uncompress/gunzip utility, there is
  226. a file ASA-shar which is an uncompress'd copy of  ASA-shar.Z;  if
  227. you do not have sh or shar, you still can delete the first-column
  228. X's and separate the files at the END_OF_FILE  locations.   There
  229. are  tar'd  versions  in  compress and gzip format, ASA.tar.Z and
  230. ASA.tar.gz, respectively.  There also is a current zip'd version,
  231. ASA.zip, in which all files have been processed through unix2dos.
  232. Directory /pub/ingber/0lower.dir contains links  to  these  files
  233. for some PC users who may have difficulty with upper case.
  234.  
  235.      Patches ASA-diff-x1.y1-x2.y2.Z up to the present version can
  236. be prepared, if a good case for doing so is presented.  These may
  237. be  concatenated  as  required before applying.  If you require a
  238. specific patch that is not  contained  in  the  archive,  contact
  239. ingber@alumni.caltech.edu.
  240.  
  241. 3.2.  Electronic Mail
  242.  
  243.      If  you  do  not  have  ftp  access,  get information on the
  244. FTPmail service by: mail ftpmail@decwrl.dec.com,  and  send  only
  245. the word "help" as the body of the message.  You will receive the
  246. information  in  /pub/ingber/UTILS.DIR/ftpmail.txt.    Similarly,
  247. from a BITNET site, send the word "help" as the body of a message
  248. to bitftp@pucc (bitftp@pucc.bitnet if from an Internet site).
  249.  
  250.      If any of the above are not possible, and if your mailer can
  251. handle  large  files (please test this first), the code or papers
  252. you require can  be  sent  as  uuencode'd  compress'd  files  via
  253. electronic  mail.   If you have gzip, resulting in smaller files,
  254. please state this.
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.                               - 3 -
  263.  
  264.  
  265.  
  266.  
  267.  
  268. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  269.  
  270.  
  271. 3.3.  ASA Mailing List
  272.  
  273.      If you wish to be placed on the electronic mailing  ASA_list
  274. to  receive  major  updates  between  public announcements of new
  275. versions,  please   send   e-mail   stating   this   request   to
  276. asa-request@alumni.caltech.edu.   Update  notices are sent to the
  277. ASA_list about every month or two, more frequently if  warranted,
  278. e.g., in cases of important bug fixes; these notices are the only
  279. e-mail sent to the ASA_list.  This is highly recommended  if  you
  280. plan  to use ASA on complex systems, as there is ongoing research
  281. using and testing ASA by many users.  To  unsubscribe  from  this
  282. list,  simply  send  an  electronic  mail  with  this  request to
  283. asa-request@alumni.caltech.edu.
  284.  
  285. 4.  Background
  286.  
  287.  
  288. 4.1.  Context
  289.  
  290.      The ASA code was  first  developed  in  1987  as  Very  Fast
  291. Simulated  Reannealing  (VFSR)  to  deal  with  the  necessity of
  292. performing adaptive global optimization on multivariate nonlinear
  293. stochastic  systems[2].   VFSR was recoded and applied to several
  294. complex  systems,  in   combat   analysis[3],   finance[4],   and
  295. neuroscience[5].   The first applications to combat analysis used
  296. code  written  in  RATFOR  and  converted  into  FORTRAN.   Other
  297. applications  since  then  have used new code written in C.  (The
  298. NOTES file contains some comments on interfacing ASA with FORTRAN
  299. codes.)  A paper has indicated how this technique can be enhanced
  300. by combining it with some other  powerful  algorithms,  e.g.,  to
  301. produce  an  algorithm  for parallel computation[6].  In November
  302. 1992, the VFSR C-code was rewritten, e.g., changing to the use of
  303. long  descriptive  names,  and made publicly available as version
  304. 6.35 under the same GNU license as this ASA code[7].
  305.  
  306.      Beginning  in  January  93,  many  adaptive  features   were
  307. developed,  largely  in  response  to users' requests, leading to
  308. this ASA code.  ASA has been examined in the context of a  review
  309. of   methods   of  simulated  annealing  using  annealing  versus
  310. quenching (faster temperature schedules than permitted  by  basic
  311. heuristic  proof  of  ergodicity)[8].  ASA is now used world-wide
  312. across many disciplines[9].
  313.  
  314. 4.2.  Outline of ASA Algorithm
  315.  
  316.      Details of the ASA algorithm  are  best  obtained  from  the
  317. published  papers.  There are three parts to its basic structure.
  318.  
  319. 4.2.1.  Generating Probability Density Function
  320.  
  321.      In  a  D-dimensional  parameter  space  with  parameters p^i
  322. having ranges [A_i, B_i], about the k'th last saved point (e.g, a
  323. local   optima),   p_k^i,  a  new  point  is  generated  using  a
  324. distribution defined by the product  of  distributions  for  each
  325.  
  326.  
  327.  
  328.                               - 4 -
  329.  
  330.  
  331.  
  332.  
  333.  
  334. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  335.  
  336.  
  337. parameter,  g^i(y^i;  T_i),  in  terms of random variables y^i in
  338. [-1,  1],  where  p_k+1^i  =  p_k^i  +  y^i(B_i   -   A_i),   and
  339. "temperatures" T_i,
  340.         g^i(y^i; T_i) = 1/[2(|y^i| + T_i)(1 + 1/T_i)].
  341.  
  342. 4.2.2.  Acceptance Probability Density Function
  343.  
  344.      The cost functions, C(p_k+1) - C(p_k), are compared using  a
  345. uniform random generator, U in [0, 1), in a "Boltzmann" test: If
  346.         exp[-(C(p_k+1) - C(p_k))/T_cost] > U,
  347. where  T_cost  is  the "temperature" used for this test, then the
  348. new point is accepted  as  the  new  saved  point  for  the  next
  349. iteration.  Otherwise, the last saved point is retained.
  350.  
  351. 4.2.3.  Reannealing Temperature Schedule
  352.  
  353.      The  annealing schedule for each parameter temperature, T_i,
  354. from a starting temperature T_i0, is
  355.         T_i(k_i) = T_0i exp(-c_i k_i^(1/D)).
  356. This is discussed further below.
  357.  
  358.      The annealing schedule for the cost temperature is developed
  359. similarly  to the parameter temperatures.  However, the index for
  360. reannealing the cost  function,  k_cost,  is  determined  by  the
  361. number  of  accepted  points,  instead of the number of generated
  362. points as used for the parameters.  This choice was made  because
  363. the   Boltzmann   acceptance   criteria   uses   an   exponential
  364. distribution which is not as fat-tailed as the  ASA  distribution
  365. used  for  the  parameters.   This schedule can be modified using
  366. several OPTIONS.  In particular, the  Pre-Compile  DEFINE_OPTIONS
  367. USER_COST_SCHEDULE    permits    quite    arbitrary    functional
  368. modifications for this annealing schedule.
  369.  
  370.      As determined by the Program Options selected, the parameter
  371. "temperatures"  may  be  periodically  adaptively  reannealed, or
  372. increased relative to their previous values, using their relative
  373. first derivatives with respect to the cost function, to guide the
  374. search "fairly" among the parameters.
  375.  
  376. 4.3.  Efficiency Versus Necessity
  377.  
  378.      ASA is not necessarily an "efficient" code.  For example, if
  379. you  know  that  your  cost function to be optimized is something
  380. close to a parabola, then a simple gradient Newton search  method
  381. most  likely  would  be  faster  than ASA.  ASA is believed to be
  382. faster and more robust than other simulated annealing  techniques
  383. for  most  complex problems with multiple local optima; again, be
  384. careful to note that some problems  are  best  treated  by  other
  385. algorithms.   If you do not know much about the structure of your
  386. system, and especially if it has  complex  constraints,  and  you
  387. need  to  search  for  a  global  optimum,  then this ASA code is
  388. heartily recommended to you.
  389.  
  390.  
  391.  
  392.  
  393.  
  394.                               - 5 -
  395.  
  396.  
  397.  
  398.  
  399.  
  400. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  401.  
  402.  
  403. 5.  Outline of Use
  404.  
  405.      Set up the ASA interface: Your  program  should  be  divided
  406. into   two  basic  modules.   (1)  The  user  calling  procedure,
  407. containing the cost function to be minimized (or its negative  if
  408. you  require  a  global maximum), here is contained in user.c and
  409. user.h.  (2) The ASA optimization procedure, here is contained in
  410. asa.c  and  asa.h.   The file asa_user.h contains definitions and
  411. macros common to both asa.h and user.h.  Furthermore,  there  are
  412. some  options to explore/read below.  It is assumed there will be
  413. no confusion over the standard uses of the  term  "parameter"  in
  414. different contexts, e.g., as an element passed by a subroutine or
  415. as a physical coefficient in a cost function.
  416.  
  417.      ASA has been run successfully on many  machines  under  many
  418. compilers.   To check out your own system, you can run `make` (or
  419. the equivalent set of commands in the Makefile), and compare your
  420. asa_out  and  user_out  files to the test_asa and test_usr files,
  421. respectively,  provided  with  this  code.   (For   these   runs,
  422. TIME_CALC=TRUE,  discussed  below,  was  added to the compilation
  423. options.)  No attempt was made to optimize any compiler, so  that
  424. the  test  runs do not really signify any testing of compilers or
  425. architectures; rather they are meant to be used  as  a  guide  to
  426. determine what you might expect on your own machine.
  427.  
  428.      The   major   sections   below   describe   the  compilation
  429. procedures, the Program Options available to you to  control  the
  430. code,  the  use  of  templates  to  set  up  your user module and
  431. interface to the asa module, and how to submit bug reports.
  432.  
  433.      If you already have your own cost  function  defined,  as  a
  434. quick guide to get started, you can search through user.c for all
  435. occurrences of "MY_COST"  to  insert  the  necessary  definitions
  436. required to run ASA.
  437.  
  438. 6.  Makefile/Compilation Procedures
  439.  
  440.      The  PostScript(R)  README.ps  and  ASCII README and README+
  441. files were generated using `make doc'.   The  Makefile  describes
  442. some  options for formatting these files differently.  Use `make'
  443. or `make all' to compile and run asa_run, the executable prepared
  444. for  the  test  function.   Examine the Makefile to determine the
  445. "clean" options available.
  446.  
  447.      Since complex problems  by  their  nature  are  often  quite
  448. unique, it is unlikely that the default parameters are just right
  449. for your problem.  However, experience has shown that  if  you  a
  450. priori  do  not have any reason to determine your own parameters,
  451. then you might do just fine using these defaults, and  these  are
  452. recommended  as  a  first-order  guess.   These  defaults  can be
  453. changed simply by  adding  to  the  DEFINE_OPTIONS  line  in  the
  454. Makefile,  by  passing  options  on  your  command  line,  and by
  455. changing  structure  elements  in  the  user  or  asa  module  as
  456. described  below.   Depending  on how you integrate ASA into your
  457.  
  458.  
  459.  
  460.                               - 6 -
  461.  
  462.  
  463.  
  464.  
  465.  
  466. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  467.  
  468.  
  469. own user modules, you may wish to  modify  this  Makefile  or  at
  470. least   use  some  of  these  options  in  your  own  compilation
  471. procedures.
  472.  
  473.      Note  that  the  Makefile  is  just  a  convenience,  not  a
  474. necessity,  to  use  ASA.   E.g., on systems which do not support
  475. this utility, you may simply  compile  the  files  following  the
  476. guidelines  in  the  Makefile,  taking  care  to pass the correct
  477. DEFINE_OPTIONS to your compilation commands at your shell prompt.
  478. Still  another  way,  albeit  not  as  convenient, is to make the
  479. desired changes in the asa_user.h, and asa.h or user.h  files  as
  480. required.
  481.  
  482.      Since   the   Makefile   contains   comments   giving  short
  483. descriptions of some options,  it  should  be  considered  as  an
  484. extension  of  this documentation file.  For convenience, most of
  485. this information is repeated below.  However, to see how they can
  486. be used in compilations, please read through the Makefile.
  487.  
  488.      For  example,  to  run  the  ASA  test problem using the gcc
  489. compiler, you could just type at your "%" prompt:
  490.         % gcc -g -DASA_TEST=TRUE -o asa_run user.c asa.c -lm
  491.         % asa_run
  492. You may have to feed different options to your own compiler.  The
  493. resulting  asa_out file should only differ from the test_asa file
  494. by having different values for  the  OPTIONS_FILE  and  TIME_CALC
  495. lines, and by not having a few lines marking the CPU time.
  496.  
  497.      If  you  have  defined  your  own  cost  function within the
  498. "MY_COST" guides in user.c, then ASA_TEST should be set to  FALSE
  499. (the default if ASA_TEST is not defined in your compilation lines
  500. or in the Makefile).  The code for ASA_TEST=TRUE  is  given  just
  501. above  these  guides  as  a  template  to  use  for your own cost
  502. function.
  503.  
  504. 7.  User Options
  505.  
  506.      The DEFINE_OPTIONS  are  organized  into  two  groups:  Pre-
  507. Compile Options and (Pre-Compile) Printing Options.  In addition,
  508. there are some alternatives to explore under Compiler Choices and
  509. Document  Formatting.   Below  are  the DEFINE_OPTIONS with their
  510. defaults.  The Program Options are  further  discussed  in  other
  511. sections in this document.
  512.  
  513. 7.1.  Pre-Compile DEFINE_OPTIONS
  514.  
  515.  
  516. 7.1.1.  OPTIONS_FILE=TRUE
  517.  
  518.      You can elect to read in the Program Options from asa_opt by
  519. setting OPTIONS_FILE=TRUE.  OPTIONS_FILE=TRUE can be set  in  the
  520. Makefile in compilation commands or in asa_user.h.
  521.  
  522.  
  523.  
  524.  
  525.  
  526.                               - 7 -
  527.  
  528.  
  529.  
  530.  
  531.  
  532. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  533.  
  534.  
  535. 7.1.2.  ASA_LIB=FALSE
  536.  
  537.      Setting ASA_LIB=TRUE will facilitate your running asa() as a
  538. library call from another program, calling asa_main() in  user.c.
  539. In  the templates provided, all initializations and cost function
  540. definitions are set up in user.c.  For example, you may  wish  to
  541. have  some  data  read in to a module that calls asa_main(), then
  542. parses out this information  to  the  arrays  in  asa_main()  and
  543. initialize_parameters (and possibly recur_initialize_parameters).
  544. In conjunction with setting printout to stdout (see  ASA_OUT  and
  545. USER_ASA_OUT),  this  can  be  a convenient way of using the same
  546. asa_run executable for many runs.
  547.  
  548. 7.1.3.  HAVE_ANSI=TRUE
  549.  
  550.      Setting HAVE_ANSI=FALSE will permit you to use an older  K&R
  551. C  compiler.   This option can be used if you do not have an ANSI
  552. compiler, overriding the  default  HAVE_ANSI=TRUE.   If  you  use
  553. HAVE_ANSI=FALSE,  change  CC  and CDEBUGFLAGS as described in the
  554. Makefile.
  555.  
  556. 7.1.4.  IO_PROTOTYPES=TRUE
  557.  
  558.      Some machines do not like any other  I/O  prototyping  other
  559. than  those in their own include files, e.g., like one Convex-120
  560. that was tested.  Other machines, like a  Dec-3100  under  Ultrix
  561. complained that the ANSI I/O prototypes were inconsistent.  A Sun
  562. under gcc gave  warnings  if  no  I/O  prototypes  were  present.
  563. Therefore,  the  defaults in asa_user.h use K&R system prototypes
  564. even for the ANSI compiler,  for  fprintf,  fflush,  fclose,  and
  565. exit, and for fscanf in user.h.  Setting IO_PROTOTYPES=FALSE will
  566. comment out even these declarations.  This also has worked on  an
  567. Indigo and on a Cray C90/UNICOS 8.0.
  568.  
  569. 7.1.5.  TIME_CALC=FALSE
  570.  
  571.      Some  systems  do not have the time include files used here;
  572. others have different scales for  time.   Setting  TIME_CALC=TRUE
  573. will  permit  use  of  the  time routines.  In the NOTES are some
  574. contributed code  that  should  be  useful  for  some  particular
  575. systems.
  576.  
  577. 7.1.6.  TIME_STD=FALSE
  578.  
  579.      Some  systems, e.g., hpux, use other Unix-standard macros to
  580. access time.  Setting  TIME_STD=TRUE  when  using  TIME_CALC=TRUE
  581. will use these time routines instead.
  582.  
  583. 7.1.7.  INT_LONG=TRUE
  584.  
  585.      Some smaller systems choke on `long int' and this option can
  586. be set to INT_LONG=FALSE to turn off warnings and  possibly  some
  587. errors.   The cast LONG_INT is used to define `int' or `long int'
  588. appropriately.
  589.  
  590.  
  591.  
  592.                               - 8 -
  593.  
  594.  
  595.  
  596.  
  597.  
  598. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  599.  
  600.  
  601. 7.1.8.  INT_ALLOC=FALSE
  602.  
  603.      The cast on *number_parameters is  set  to  ALLOC_INT  which
  604. defaults  to LONG_INT.  On some machines, ALLOC_INT might have to
  605. be set to int  if  there  is  a  strict  requirement  to  use  an
  606. (unsigned) int for calloc, while `long int' still can be used for
  607. other aspects of ASA.  If ALLOC_INT is to  be  set  to  int,  set
  608. INT_ALLOC to TRUE.
  609.  
  610. 7.1.9.  SMALL_FLOAT=1.0E-18
  611.  
  612.      SMALL_FLOAT  is  a  measure of accuracy permitted in log and
  613. divide operations in asa, i.e., which is not precisely equivalent
  614. to  a  given  machine's  precision.   There  also are Pre-Compile
  615. DEFINE_OPTIONS  to  separately  set  constants  for  minimum  and
  616. maximum doubles and precision permitted by your machine.  Experts
  617. who  require  the  very  best  precision  can   fine-tune   these
  618. parameters in the code.
  619.  
  620.      Such  issues  arise  because the fat tail of ASA, associated
  621. with high parameter temperatures, is very important for searching
  622. the  breadth  of  the  ranges especially in the initial stages of
  623. search.  However, the parameter temperatures require small values
  624. at  the  final  stages  of  the  search  to  converge to the best
  625. solution,  albeit  this  is  reached  very  quickly   given   the
  626. exponential  schedule proven in the referenced publications to be
  627. permissible with ASA.  Note that the test problem in user.c is  a
  628. particularly  nasty one, with 1E20 local minima and requiring ASA
  629. to search over 12 orders of magnitude of the cost function before
  630. correctly  finding the global minimum.  Thus, intermediate values
  631. disagree somewhat for SMALL_FLOAT=1.0E-12 from the settings using
  632. SMALL_FLOAT=1.0E-18     (the    default);     they    agree    if
  633. SMALL_FLOAT=1.0E-12 while also setting  MIN_DOUBLE=1.0E-18.   The
  634. results  diverge  when the parameter temperatures get down to the
  635. range of E-12, limiting the accuracy of  the  SMALL_FLOAT=1.0E-12
  636. run.
  637.  
  638. 7.1.10.  MIN_DOUBLE=SMALL_FLOAT
  639.  
  640.      You  can  define  your own machine's minimum positive double
  641. here if you know it.
  642.  
  643. 7.1.11.  MAX_DOUBLE=1.0/SMALL_FLOAT
  644.  
  645.      You can define your own machine's maximum double here if you
  646. know it.
  647.  
  648. 7.1.12.  EPS_DOUBLE=SMALL_FLOAT
  649.  
  650.      You  can define your own machine's maximum precision here if
  651. you know it.
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.                               - 9 -
  659.  
  660.  
  661.  
  662.  
  663.  
  664. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  665.  
  666.  
  667. 7.1.13.  NO_PARAM_TEMP_TEST=FALSE
  668.  
  669.      If NO_PARAM_TEMP_TEST is set to  TRUE,  then  all  parameter
  670. temperatures  less  than EPS_DOUBLE are set to EPS_DOUBLE, and no
  671. exit is called.
  672.  
  673. 7.1.14.  NO_COST_TEMP_TEST=FALSE
  674.  
  675.      If NO_COST_TEMP_TEST is set to TRUE, then a cost temperature
  676. less than EPS_DOUBLE is set to EPS_DOUBLE, and no exit is called.
  677.  
  678. 7.1.15.  SELF_OPTIMIZE=FALSE
  679.  
  680.      The user module contains a template to  illustrate  how  ASA
  681. may  be  used  to self-optimize its Program Options.  This can be
  682. very CPU-expensive and is of course dependent on how  you  define
  683. your  recursive  cost  function  (recur_cost_function in the user
  684. module).  The example given returns from recur_cost_function  the
  685. number  of  function  evaluations  taken to optimization the test
  686. cost_function, with the constraint to only  accept  optimizations
  687. of  the  cost_function  that are lower than a specified value.  A
  688. few lines of code can be uncommented in user.c to  force  a  fast
  689. exit  for  this  demo;  search  for FAST EXIT.  This example uses
  690. OPTIONS_FILE=FALSE (the default) in the Pre-Compile Options; note
  691. that  OPTIONS_FILE=TRUE  here  would  set  Program  Options  from
  692. asa_opt for the top level program, not for  the  Program  Options
  693. for the cost_function().
  694.  
  695.      This  can be useful when approaching a new system, and it is
  696. suspected that the default ASA Program Options  are  not  at  all
  697. efficient  for  this system.  It is suggested that a trimmed cost
  698. function or data set be used to get a reasonable guess for a good
  699. set  of  Program Options.  ASA has demonstrated that it typically
  700. is quite robust under a given set of Program Options, so it might
  701. not  make  too  much  sense to spend lots of resources performing
  702. additional fine  tuning  of  the  these  options.   Also,  it  is
  703. possible you might crash the code by permitting ranges of Program
  704. Options  that  cause  your  particular  cost_function  to  return
  705. garbage to asa().
  706.  
  707. 7.1.16.  ASA_TEST=FALSE
  708.  
  709.      Setting  ASA_TEST  to  TRUE will permit running the ASA test
  710. problem.  This has  been  added  to  the  DEFINE_OPTIONS  in  the
  711. Makefile  so that just running make will run the test problem for
  712. the new user.
  713.  
  714.      Searching user.c for "MY_COST" provides a guide to the  user
  715. for  additional  code  to add for his/her own system.  Just above
  716. each occurrence of these guides is  the  corresponding  code  for
  717. ASA_TEST=TRUE.   Keeping  the  default  of  ASA_TEST set to FALSE
  718. permits such changes without overwriting the test example.
  719.  
  720.  
  721.  
  722.  
  723.  
  724.                               - 10 -
  725.  
  726.  
  727.  
  728.  
  729.  
  730. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  731.  
  732.  
  733. 7.1.17.  ASA_TEMPLATE=FALSE
  734.  
  735.      There are several templates that come  with  the  ASA  code,
  736. used  to  test  several  OPTIONS.  To permit use of these OPTIONS
  737. without having to delete these extra tests, these  templates  are
  738. wrapped  with  ASA_TEMPLATE.   To use tests associated with these
  739. OPTIONS, which can be determined by reading the  code,  just  set
  740. ASA_TEMPLATE  to  TRUE  in  the  Makefile  or in your compilation
  741. procedures.
  742.  
  743.      Note that running the ASA test  problem  in  user.c  is  not
  744. affected  by  ASA_TEMPLATE.   To  use your own cost function, you
  745. must at least rewrite relevant portions  of  cost_function()  and
  746. initialize_parameters() in user.c.
  747.  
  748. 7.1.18.  OPTIONAL_DATA=FALSE
  749.  
  750.      It  can  be  useful  to return additional information to the
  751. user module from the asa module.  When OPTIONAL_DATA  is  set  to
  752. true,  an  additional  Program  Option  pointer,  *asa_data,   is
  753. available in USER_DEFINES *OPTIONS to gather such data.
  754.  
  755.      In one ASA_TEMPLATE provided (see the set of  DEFINE_OPTIONS
  756. used  in  the  Makefile),  OPTIONAL_DATA  is  used  together with
  757. SELF_OPTIMIZE to find  the  set  of  ASA  parameters  giving  the
  758. (statistically)  smallest number of generated points to solve the
  759. ASA test problem, assuming  this  were  run  several  times  with
  760. different  random  seeds  for  randflt  in user.c (e.g., changing
  761. "seed" in myrand).  Here, asa_data[0] is used as a flag to  print
  762. out asa_data[1] in user.c, set to *best_number_generated_saved in
  763. asa.c.
  764.  
  765. 7.1.19.  USER_COST_SCHEDULE=FALSE
  766.  
  767.      The function used to control the  cost_function  temperature
  768. schedule  is  of the form test_temperature in asa.c.  If the user
  769. sets the Pre-Compile DEFINE_OPTIONS USER_COST_SCHEDULE  to  TRUE,
  770. then   this  function  of  test_temperature  can  be  controlled,
  771. adaptively if desired,  in  user.c  in  cost_schedule()  (and  in
  772. recur_cost_schedule()   if  SELF_OPTIMIZE  is  TRUE)  by  setting
  773. USER_COST_SCHEDULE to TRUE.  The names of these functions are set
  774. to the relevant pointer in user.c, and can be changed if desired,
  775. i.e.,
  776.    USER_OPTIONS->cost_schedule = user_cost_schedule;
  777.    RECUR_USER_OPTIONS->cost_schedule = recur_user_cost_schedule;
  778.  
  779. 7.1.20.  USER_REANNEAL_FUNCTION=FALSE
  780.  
  781.      In asa.h, the macro
  782.    #define \
  783.            REANNEAL_FUNCTION(temperature, tangent, max_tangent) \
  784.               (temperature * (max_tangent / tangent))
  785. is used to determine the  new  temperature,  subject  to  further
  786. tests    in    reanneal().     This    is    the    default    if
  787.  
  788.  
  789.  
  790.                               - 11 -
  791.  
  792.  
  793.  
  794.  
  795.  
  796. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  797.  
  798.  
  799. USER_REANNEAL_FUNCTION is FALSE.
  800.  
  801.      If   the   user   sets   the   Pre-Compile    DEFINE_OPTIONS
  802. USER_REANNEAL_FUNCTION to TRUE, then the function controlling the
  803. new reannealed  temperature  can  be  controlled,  adaptively  if
  804. desired  using USER_OPTIONS, in user.c in user_reanneal(), and in
  805. recur_user_reanneal() if SELF_OPTIMIZE is  TRUE.   The  names  of
  806. these  functions  are  set to the relevant pointer in user.c, and
  807. can be changed if desired, i.e.,
  808.    USER_OPTIONS->reanneal_function = user_reanneal;
  809.    RECUR_USER_OPTIONS->reanneal_function = recur_user_reanneal;
  810.  
  811. 7.1.21.  ASA_SAMPLE=FALSE
  812.  
  813.      When ASA_SAMPLE is set to TRUE, data  is  collected  by  ASA
  814. during  its  global optimization process to importance-sample the
  815. user's variables.  Five OPTIONS become available to  monitor  the
  816. sampling:     n_accepted,    bias_acceptance,    *bias_generated,
  817. average_weights, and limit_weights.
  818.  
  819.      If   average_weights   exceeds   the   user's   choice    of
  820. limit_weights,  then  the  ASA_OUT  file  will contain additional
  821. detailed information, including temperatures and biases for  each
  822. current  parameter.   To facilitate extracting importance-sampled
  823. information from the file printed out  by  the  asa  module,  all
  824. relevant lines start with :SAMPLE[ |:|#|+].
  825.  
  826.      Many  Monte  Carlo  sampling  techniques require the user to
  827. guess an appropriately decreasing "window" to sample the variable
  828. space.   The  fat  tail  of  the ASA generating function, and the
  829. decreasing effective range of newly  accepted  points  driven  by
  830. exponentially  decreasing  temperature  schedules,  removes  this
  831. arbitrary aspect of such sampling.
  832.  
  833.      However, note that, albeit local  optima  are  sampled,  the
  834. efficiency  of ASA optimization most often leads to poor sampling
  835. in regions whose cost function is far  from  the  optimal  point;
  836. many  such  points  may  be important contributions to algorithms
  837. like integrals.  Accordingly, ASA_SAMPLE likely is best  used  to
  838. explore new regions and new systems.
  839.  
  840.      To  increase  the  sampling  rate  and  thereby  to possibly
  841. increase the accuracy of this algorithm, use one or a combination
  842. of  the  various OPTIONS available for slowing down the annealing
  843. performed by ASA.
  844.  
  845. 7.1.22.  ASA_PARALLEL=FALSE
  846.  
  847.      When  ASA_PARALLEL  is  set  to  TRUE,  parallel  blocks  of
  848. generated states are calculated of number equal to the minimum of
  849. OPTIONS->gener_block  and  OPTIONS->gener_block_max.   For   most
  850. systems  with  complex  nonlinear cost functions that require the
  851. fat tail of the ASA distribution, leading to  high  generated  to
  852. acceptance  ratios,  this  is  the most CPU intensive part of ASA
  853.  
  854.  
  855.  
  856.                               - 12 -
  857.  
  858.  
  859.  
  860.  
  861.  
  862. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  863.  
  864.  
  865. that can benefit from parallelization.
  866.  
  867.      The actual number  calculated  is  determined  by  a  moving
  868. average,  determined  by  OPTIONS->gener_mov_avr, of the previous
  869. numbers of OPTIONS->gener_block of generated states  required  to
  870. find    a    new    best    accepted    state.    If   and   when
  871. OPTIONS->gener_mov_avr is set to 0, then OPTIONS->gener_block  is
  872. not changed thereafter.
  873.  
  874. 7.2.  Printing DEFINE_OPTIONS
  875.  
  876.  
  877. 7.2.1.  ASA_PRINT=TRUE
  878.  
  879.      Setting this to FALSE will suppress all printing within asa.
  880.  
  881. 7.2.2.  ASA_OUT=\"asa_out\"
  882.  
  883.      The name of the output file  containing  all  printing  from
  884. asa.    If   you   wish   to   attach   a   process   number  use
  885. ASA_OUT=\"asa_out_$$\".  (Use ASA_OUT=\"asa_out_$$$$\" if this is
  886. set  in  the Makefile.) If ASA_OUT=\"STDOUT\" then ASA will print
  887. to stdout.
  888.  
  889. 7.2.3.  USER_ASA_OUT=FALSE
  890.  
  891.      When USER_ASA_OUT is set  to  TRUE,  an  additional  Program
  892. Option  pointer,  *asa_out_file,  is  used to dynamically set the
  893. name(s) of the file(s) printed out  by  the  asa  module.   (This
  894. overrides    any    ASA_OUT    settings.)     In    user.c,    if
  895. USER_OPTIONS->asa_out_file = "STDOUT";, then ASA  will  print  to
  896. stdout.
  897.  
  898.      In  one ASA_TEMPLATE provided (see the set of DEFINE_OPTIONS
  899. used in the Makefile), USER_ASA_OUT is used to generate  multiple
  900. files  of separate ASA runs.  (If USER_OPTIONS->QUENCH_PARAMETERS
  901. and/or USER_OPTIONS->QUENCH_COST is set to TRUE in  user.c,  then
  902. this  ASA_TEMPLATE  will  separate  runs with different quenching
  903. values.)
  904.  
  905. 7.2.4.  ASA_PRINT_INTERMED=TRUE
  906.  
  907.      This option is only effective if ASA_PRINT is TRUE.  Setting
  908. ASA_PRINT_INTERMED  to  FALSE  will  suppress  much  intermediate
  909. printing within asa, especially arrays which can  be  large  when
  910. the  number  of  parameters  is  large.  Printing at intermediate
  911. stages  of  testing/reannealing  has   been   turned   off   when
  912. SELF_OPTIMIZE  is  set to TRUE, since there likely can be quite a
  913. bit of data generated; this can be changed by explicitly  setting
  914. ASA_PRINT_INTERMED to TRUE in the Makefile or on your compilation
  915. command lines.
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.                               - 13 -
  923.  
  924.  
  925.  
  926.  
  927.  
  928. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  929.  
  930.  
  931. 7.2.5.  ASA_PRINT_MORE=FALSE
  932.  
  933.      Setting  ASA_PRINT_MORE  to  TRUE  will   print   out   more
  934. intermediate  information,  e.g.,  new  parameters whenever a new
  935. minimum is reported.  As is the case whenever  tangents  are  not
  936. calculated   by   choosing   some   ASA   options,  normally  the
  937. intermediate values of tangents will not be up to date.
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.                               - 14 -
  989.  
  990.  
  991.  
  992.  
  993.  
  994. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  995.  
  996.  
  997. 7.3.  Program OPTIONS
  998.    typedef struct {
  999.           LONG_INT LIMIT_ACCEPTANCES;
  1000.           LONG_INT LIMIT_GENERATED;
  1001.           int LIMIT_INVALID_GENERATED_STATES;
  1002.           double ACCEPTED_TO_GENERATED_RATIO;
  1003.  
  1004.           double COST_PRECISION;
  1005.           int MAXIMUM_COST_REPEAT;
  1006.           int NUMBER_COST_SAMPLES;
  1007.           double TEMPERATURE_RATIO_SCALE;
  1008.           double COST_PARAMETER_SCALE;
  1009.           double TEMPERATURE_ANNEAL_SCALE;
  1010.           int USER_INITIAL_COST_TEMP;
  1011.           double *user_cost_temperature;
  1012.  
  1013.           int INCLUDE_INTEGER_PARAMETERS;
  1014.           int USER_INITIAL_PARAMETERS;
  1015.           ALLOC_INT SEQUENTIAL_PARAMETERS;
  1016.           double INITIAL_PARAMETER_TEMPERATURE;
  1017.           int RATIO_TEMPERATURE_SCALES;
  1018.           double *user_temperature_ratio;
  1019.           int USER_INITIAL_PARAMETERS_TEMPS;
  1020.           double *user_parameter_temperature;
  1021.  
  1022.           int TESTING_FREQUENCY_MODULUS;
  1023.           int ACTIVATE_REANNEAL;
  1024.           double REANNEAL_RESCALE;
  1025.           LONG_INT MAXIMUM_REANNEAL_INDEX;
  1026.  
  1027.           double DELTA_X;
  1028.           int DELTA_PARAMETERS;
  1029.           double *user_delta_parameter;
  1030.           int USER_TANGENTS;
  1031.           int CURVATURE_0;
  1032.  
  1033.           int QUENCH_PARAMETERS;
  1034.           double *user_quench_param_scale;
  1035.           int QUENCH_COST;
  1036.           double *user_quench_cost_scale;
  1037.  
  1038. #if OPTIONAL_DATA
  1039.           double *asa_data;
  1040. #endif
  1041. #if USER_ASA_OUT
  1042.           char *asa_out_file;
  1043. #endif
  1044. #if USER_COST_SCHEDULE
  1045.           double (*cost_schedule) ();
  1046. #endif
  1047. #if USER_REANNEAL_FUNCTION
  1048.           double (*reanneal_function) ();
  1049. #endif
  1050. #if ASA_SAMPLE
  1051.  
  1052.  
  1053.  
  1054.                               - 15 -
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  1061.  
  1062.  
  1063.           int n_accepted;
  1064.           double bias_acceptance;
  1065.           double *bias_generated;
  1066.           double average_weights;
  1067.           double limit_weights;
  1068. #endif
  1069. #if ASA_PARALLEL
  1070.           int gener_mov_avr;
  1071.           LONG_INT gener_block;
  1072.           LONG_INT gener_block_max;
  1073. #endif
  1074.    }
  1075. USER_DEFINES;
  1076.  
  1077.      Note that two ways are maintained for  passing  the  Program
  1078. Options.   Check  the  comments  in  the  NOTES  file.  It may be
  1079. necessary to change some of the options for some  systems.   Read
  1080. the  NOTES  file  for some ongoing discussions and suggestions on
  1081. how to try to optimally set these options.  Note the  distinction
  1082. between  trying  to speed up annealing/quenching versus trying to
  1083. slow down annealing (which sometimes can speed up the  search  by
  1084. avoiding  spending  too much time in some local optimal regions).
  1085. Templates are set up in  ASA  to  accommodate  all  alternatives.
  1086. Below, the defaults are given in square brackets [].
  1087.  
  1088. (A)  user module.
  1089.      When  using  ASA  as  part  of a large library, it likely is
  1090.      easiest to make these changes within the user module,  e.g.,
  1091.      using  the  template  placed in user.c.  The Program Options
  1092.      are stored in the  structure  USER_DEFINES  *OPTIONS  (named
  1093.      USER_DEFINES *USER_OPTIONS in the user module).
  1094.  
  1095. (B)  asa module.
  1096.      It  likely  is most efficient to use a separate data file in
  1097.      the asa module, avoiding repeated compilations of the  code,
  1098.      to test various combinations of Program Options, e.g., using
  1099.      the file asa_opt when OPTIONS_FILE=TRUE in the  Makefile  or
  1100.      on your compilation command lines.
  1101.  
  1102. 7.3.1.  OPTIONS->LIMIT_ACCEPTANCES[10000]
  1103.  
  1104.      The  maximum number of states accepted before quitting.  All
  1105. the templates in ASA have been set to use  LIMIT_ACCEPTANCES=1000
  1106. to   illustrate  the  way  these  options  can  be  changed.   If
  1107. LIMIT_ACCEPTANCES is set to 0, then no limit is  observed.   This
  1108. can be useful for some systems that cannot handle large integers.
  1109. (To exit at a  specific  number  of  generated  points,  see  the
  1110. discussion at LIMIT_INVALID_GENERATED_STATES below.)
  1111.  
  1112. 7.3.2.  OPTIONS->LIMIT_GENERATED[99999]
  1113.  
  1114.      The  maximum number of states generated before quitting.  If
  1115. LIMIT_GENERATED is set to 0, then no limit is observed.  This can
  1116. be  useful  for  some  systems that cannot handle large integers.
  1117.  
  1118.  
  1119.  
  1120.                               - 16 -
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  1127.  
  1128.  
  1129. (To exit at a  specific  number  of  generated  points,  see  the
  1130. discussion at LIMIT_INVALID_GENERATED_STATES below.)
  1131.  
  1132. 7.3.3.  OPTIONS->LIMIT_INVALID_GENERATED_STATES[1000]
  1133.  
  1134.      This  sets  limits  of  repetitive invalid generated states,
  1135. e.g., when using this method to include constraints.   This  also
  1136. can  be useful to quickly exit asa() if this is requested by your
  1137. cost      function:        Setting       the       value       of
  1138. LIMIT_INVALID_GENERATED_STATES   to  0  will  exit  at  the  next
  1139. calculation of the cost  function  (possibly  after  a  few  more
  1140. exiting   calls  to  calculate  tangents  and  curvatures).   For
  1141. example, to exit asa() at a specific number of generated  points,
  1142. set  up a counter in your cost function, e.g., similar to the one
  1143. in the test function in user.c.  For all calls >=  the  limit  of
  1144. the  number  of  calls to the cost function, terminate by setting
  1145. USER_OPTIONS->LIMIT_INVALID_GENERATED_STATES  =  0  and   setting
  1146. *cost_exit  = FALSE.  (Note that the number of calls counted will
  1147. include those calls used to set up some initializations.)
  1148.  
  1149. 7.3.4.  OPTIONS->ACCEPTED_TO_GENERATED_RATIO[1.0E-6]
  1150.  
  1151.      The least ratio of accepted to generated  states.   If  this
  1152. value  is  encountered,  then the usual tests, including possible
  1153. reannealing, are initiated even if the timing does  not  coincide
  1154. with  the set TESTING_FREQUENCY_MODULUS (defined below).  All the
  1155. templates     in     ASA     have     been     set     to     use
  1156. ACCEPTED_TO_GENERATED_RATIO=1.0E-4  to  illustrate  the way these
  1157. options can be changed.
  1158.  
  1159. 7.3.5.  OPTIONS->COST_PRECISION[1.0E-18]
  1160.  
  1161.      This sets the precision required of  the  cost  function  if
  1162. exiting because of reaching MAXIMUM_COST_REPEAT.
  1163.  
  1164. 7.3.6.  OPTIONS->MAXIMUM_COST_REPEAT[5]
  1165.  
  1166.      The  maximum  number of times that the cost function repeats
  1167. itself before quitting.
  1168.  
  1169. 7.3.7.  OPTIONS->NUMBER_COST_SAMPLES[5]
  1170.  
  1171.      The number of cost function values sampled to determine  the
  1172. initial cost function temperature.
  1173.  
  1174. 7.3.8.  OPTIONS->TEMPERATURE_RATIO_SCALE[1.0E-5]
  1175.  
  1176.      This scale is a guide to the expected  cost  temperature  of
  1177. convergence  within  a  small  range  of  the global minimum.  As
  1178. explained in the ASA papers, and as outlined in the  NOTES,  this
  1179. is  used  to  set  the  rates  of  annealing.   Here  is  a brief
  1180. description in terms of the temperature schedule outlined  above.
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.                               - 17 -
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  1193.  
  1194.  
  1195.      As  a  useful  physical  guide,  the  temperature is further
  1196. parameterized in terms of quantities m_i and n_i, derived from an
  1197. "expected"  final  temperature  (which  is  not enforced in ASA),
  1198. T_fi,
  1199.         T_fi = T_0i exp(-m_i) when k_fi = exp(n_i),
  1200.         c_i = m_i exp(-n_i/D).
  1201. However, note that since the initial temperatures and  generating
  1202. indices,   T_0i  and  k_i,  are  independently  scaled  for  each
  1203. parameter, it usually is reasonable to  simply  take  {c_i,  m_i,
  1204. n_i}  to be independent of the index i, i.e., to be {c, m, n} for
  1205. all i.
  1206.  
  1207.      In asa.c,
  1208.         m = -log(TEMPERATURE_RATIO_SCALE).
  1209. This  can  be  overridden  if  RATIO_TEMPERATURE_SCALES  (further
  1210. discussed  below)  is set to TRUE, and then values of multipliers
  1211. of  -log(TEMPERATURE_RATIO_SCALE)  are  used  in  asa.c.    These
  1212. multipliers    are    calculated    in   the   user   module   as
  1213. USER_OPTIONS->user_temperature_ratio[]     (and     passed     to
  1214. OPTIONS->user_temperature_ratio[] in the asa module).  Then,
  1215.         m_i = m OPTIONS->user_temperature_ratio[i].
  1216.  
  1217.      For  large numbers of parameters, TEMPERATURE_RATIO_SCALE is
  1218. a very influential Program Option in  determining  the  scale  of
  1219. parameter  annealing.   It  likely  would be best to start with a
  1220. larger value than the default, to slow down the annealing.
  1221.  
  1222. 7.3.9.  OPTIONS->COST_PARAMETER_SCALE[1.0]
  1223.  
  1224.      This  is  the  ratio of cost:parameter temperature annealing
  1225. scales.  As explained in the ASA papers, and as outlined  in  the
  1226. NOTES, this is used to set the rates of annealing.
  1227.  
  1228.      In  terms  of  the algebraic development given above for the
  1229. TEMPERATURE_RATIO_SCALE, in asa.c,
  1230.         c_cost = c COST_PARAMETER_SCALE.
  1231.  
  1232.      COST_PARAMETER_SCALE is a very influential Program Option in
  1233. determining the scale of annealing of the cost function.
  1234.  
  1235. 7.3.10.  OPTIONS->TEMPERATURE_ANNEAL_SCALE[100.0]
  1236.  
  1237.      This  scale  is  a  guide  to  achieve  the  expected   cost
  1238. temperature  sought  by TEMPERATURE_RATIO_SCALE within the limits
  1239. expected by LIMIT_ACCEPTANCES.  As explained in the  ASA  papers,
  1240. and  as  outlined  in the NOTES, this is used to set the rates of
  1241. annealing.
  1242.  
  1243.      In terms of the algebraic development given  above  for  the
  1244. TEMPERATURE_RATIO_SCALE, in asa.c,
  1245.         n = log(TEMPERATURE_ANNEAL_SCALE).
  1246.  
  1247.      For  large  numbers  of parameters, TEMPERATURE_ANNEAL_SCALE
  1248. probably should at least initially be set to values greater  than
  1249.  
  1250.  
  1251.  
  1252.                               - 18 -
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  1259.  
  1260.  
  1261. *number_parameters,  although  it  will  not be as influential as
  1262. TEMPERATURE_RATIO_SCALE.
  1263.  
  1264. 7.3.11.  OPTIONS->USER_INITIAL_COST_TEMP[FALSE]
  1265.  
  1266.      Setting   USER_INITIAL_COST_TEMP  to  TRUE  permits  you  to
  1267. specify the initial cost temperature.   This  can  be  useful  in
  1268. problems  where you want to start the search at a specific scale.
  1269.  
  1270. 7.3.12.  OPTIONS->user_cost_temperature
  1271.  
  1272.      If    USER_INITIAL_COST_TEMP    is    TRUE,    a    pointer,
  1273. OPTIONS->user_cost_temperature,  is used to adaptively initialize
  1274. parameters  temperatures.   If  this  choice  is  elected,   then
  1275. user_cost_temperature[]     must     be     initialized    (named
  1276. USER_OPTIONS->user_cost_temperature[] in the user  module).   (If
  1277. USER_INITIAL_COST_TEMP     is    FALSE,    then    the    pointer
  1278. *user_cost_temperature must be included in *OPTIONS, but it  need
  1279. not be initialized.)
  1280.  
  1281. 7.3.13.  OPTIONS->INCLUDE_INTEGER_PARAMETERS[FALSE]
  1282.  
  1283.      Include  integer  parameters  in  derivative and reannealing
  1284. calculations.   This  is  useful  when  the  parameters  can   be
  1285. analytically  continued  between  their integer values, or if you
  1286. set the parameter increments to integral values  by  setting  the
  1287. DELTA_PARAMETERS option to TRUE, as discussed further below.
  1288.  
  1289. 7.3.14.  OPTIONS->USER_INITIAL_PARAMETERS[FALSE]
  1290.  
  1291.      ASA always requests that the user guess  initial  values  of
  1292. starting  parameters,  since  that guess is as good as any random
  1293. guess the code might  make.   The  default  is  to  use  the  ASA
  1294. distribution  about  this  point  to generate an initial state of
  1295. parameters and value of the cost function that satisfy the user's
  1296. constraints.  If USER_INITIAL_PARAMETERS is set to TRUE, then the
  1297. first user's guess is used to calculate this first state.
  1298.  
  1299. 7.3.15.  OPTIONS->SEQUENTIAL_PARAMETERS[-1]
  1300.  
  1301.      The ASA default for generating new points in parameter space
  1302. is to find a new point in the full space, rather than  to  sample
  1303. the  space  one  parameter at a time as do most other algorithms.
  1304. This is in accord with the general  philosophy  of  sampling  the
  1305. space  without any prior knowledge of ordering of the parameters.
  1306. However, if you have reason to believe that at some  stage(s)  of
  1307. search  there  might  be  some benefit to sampling the parameters
  1308. sequentially, then set  SEQUENTIAL_PARAMETERS  to  the  parameter
  1309. number you wish to start your annealing cycle, i.e., ranging from
  1310. 0 to (*parameter_dimension - 1).  Then, ASA  will  cycle  through
  1311. your  parameters  in the order you have placed them in all arrays
  1312. defining their properties, keeping track of  which  parameter  is
  1313. actively   being   modified   in  OPTIONS->SEQUENTIAL_PARAMETERS,
  1314. thereby permitting adaptive  changes.   Any  negative  value  for
  1315.  
  1316.  
  1317.  
  1318.                               - 19 -
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  1325.  
  1326.  
  1327. SEQUENTIAL_PARAMETERS  will  use the default ASA algorithm.  Upon
  1328. exiting asa(), SEQUENTIAL_PARAMETERS is reset back to its initial
  1329. value.
  1330.  
  1331. 7.3.16.  OPTIONS->INITIAL_PARAMETER_TEMPERATURE[1.0]
  1332.  
  1333.      The   initial  temperature  for  all  parameters.   This  is
  1334. overridden by use of the  USER_INITIAL_PARAMETERS_TEMPS option.
  1335.  
  1336. 7.3.17.  OPTIONS->RATIO_TEMPERATURE_SCALES[FALSE]
  1337.  
  1338.      Different  rates  of  parameter  annealing  can  be set with
  1339. RATIO_TEMPERATURE_SCALES set to TRUE.  This requires initializing
  1340. an array in the user module as discussed below.
  1341.  
  1342. 7.3.18.  OPTIONS->user_temperature_ratio
  1343.  
  1344.      If    RATIO_TEMPERATURE_SCALES    is    TRUE,   a   pointer,
  1345. OPTIONS->user_temperature_ratio, is used to adaptively set ratios
  1346. of  scales  used  to  anneal the parameters in the cost function.
  1347. This can be useful when some parameters are not being reannealed,
  1348. or    when    setting    the    initial    temperatures    (using
  1349. USER_INITIAL_PARAMETERS_TEMPS set to TRUE) is not  sufficient  to
  1350. handle  all  your  parameters  properly.   This  typically is not
  1351. encountered, so it is advised  to  look  elsewhere  at  first  to
  1352. improve   your   search.    If   this  choice  is  elected,  then
  1353. user_temperature_ratio[]    must    be     initialized     (named
  1354. USER_OPTIONS->user_temperature_ratio[]  in the user module).  (If
  1355. RATIO_TEMPERATURE_SCALES   is    FALSE,    then    the    pointer
  1356. *user_temperature_ratio must be included in *OPTIONS, but it need
  1357. not be initialized.)
  1358.  
  1359. 7.3.19.  OPTIONS->USER_INITIAL_PARAMETERS_TEMPS[FALSE]
  1360.  
  1361.      Setting USER_INITIAL_PARAMETERS_TEMPS to TRUE permits you to
  1362. specify  the  initial parameter temperatures.  This can be useful
  1363. in constrained problems, where greater efficiency can be achieved
  1364. in  focussing  the search than might be permitted just by setting
  1365. upper and lower bounds.
  1366.  
  1367. 7.3.20.  OPTIONS->user_parameter_temperature
  1368.  
  1369.      If   USER_INITIAL_PARAMETERS_TEMPS   is   TRUE,  a  pointer,
  1370. OPTIONS->user_parameter_temperature,  is   used   to   adaptively
  1371. initialize  parameters  temperatures.  If this choice is elected,
  1372. then  user_parameter_temperature[]  must  be  initialized  (named
  1373. USER_OPTIONS->user_parameter_temperature[]  in  the user module).
  1374. (If USER_INITIAL_PARAMETERS_TEMPS  is  FALSE,  then  the  pointer
  1375. *user_parameter_temperature  must be included in *OPTIONS, but it
  1376. need not be initialized.)
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.                               - 20 -
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  1391.  
  1392.  
  1393. 7.3.21.  OPTIONS->TESTING_FREQUENCY_MODULUS[100]
  1394.  
  1395.      The   frequency   of   testing   for  periodic  testing  and
  1396. reannealing.
  1397.  
  1398. 7.3.22.  OPTIONS->ACTIVATE_REANNEAL[TRUE]
  1399.  
  1400.      This permits reannealing to be part of the fitting  process.
  1401. This  might  have  to be set to FALSE for systems with very large
  1402. numbers of parameters just to decrease  the  number  of  function
  1403. calls.
  1404.  
  1405. 7.3.23.  OPTIONS->REANNEAL_RESCALE[10.0]
  1406.  
  1407.      The  reannealing  scale  used when MAXIMUM_REANNEAL_INDEX is
  1408. exceeded.
  1409.  
  1410. 7.3.24.  OPTIONS->MAXIMUM_REANNEAL_INDEX[50000]
  1411.  
  1412.      The  maximum  index  (number  of steps) at which the initial
  1413. temperature and the index of  the  temperature  are  rescaled  to
  1414. avoid   losing   machine   precision.   ASA  typically  is  quite
  1415. insensitive to the value used due to the dual rescaling.
  1416.  
  1417. 7.3.25.  OPTIONS->DELTA_X[0.001]
  1418.  
  1419.      The  fractional  increment  of  parameters  used   to   take
  1420. numerical  derivatives when calculating tangents for reannealing.
  1421. This is overridden when  DELTA_PARAMETERS  is  set  to  TRUE,  as
  1422. discussed further below.
  1423.  
  1424.      Note  that  this can cause evaluations of your cost function
  1425. outside a  range  when  a  parameter  being  sampled  is  at  the
  1426. boundary.   However,  only values of parameters within the ranges
  1427. set by the user are actually used for acceptance tests.
  1428.  
  1429. 7.3.26.  OPTIONS->DELTA_PARAMETERS[FALSE]
  1430.  
  1431.      Different increments, used during reannealing  to  set  each
  1432. parameter's    numerical    derivatives,    can   be   set   with
  1433. DELTA_PARAMETERS set to  TRUE.   This  requires  initializing  an
  1434. array in the user module as discussed below.
  1435.  
  1436. 7.3.27.  OPTIONS->user_delta_parameter
  1437.  
  1438.      If      DELTA_PARAMETERS     is     TRUE,     a     pointer,
  1439. OPTIONS->user_delta_parameter,  is   used   to   adaptively   set
  1440. increments   of   parameters   used  to  take  pseudo-derivatives
  1441. (numerical derivatives).  For example,  this  can  be  useful  to
  1442. reanneal integer parameters when a choice is made to permit their
  1443. derivatives to  be  taken.   If  this  choice  is  elected,  then
  1444. OPTIONS->user_delta_parameter[]   must   be   initialized  (named
  1445. USER_OPTIONS->user_delta_parameter[] in the  user  module).   (If
  1446. DELTA_PARAMETERS is FALSE, then the pointer *user_delta_parameter
  1447.  
  1448.  
  1449.  
  1450.                               - 21 -
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  1457.  
  1458.  
  1459. must be included in *OPTIONS, but it need not be initialized.)
  1460.  
  1461. 7.3.28.  OPTIONS->USER_TANGENTS[FALSE]
  1462.  
  1463.      By  default,  asa()  calculates  numerical  tangents  (first
  1464. derivatives)  of  the cost function for use in reannealing and to
  1465. provide this information to the user.  However, if  USER_TANGENTS
  1466. is  set  to  TRUE,  then  when  asa()  requires  tangents  to  be
  1467. calculated,  a  value  of   *valid_state_generated_flag   (called
  1468. *cost_flag  in  ASA_TEST  in user.c) of FALSE is set and the cost
  1469. function is called.  The user is expected to set up a test in the
  1470. beginning  of  the  cost  function  to sense this value, and then
  1471. calculate the tangents[] array (containing the derivatives of the
  1472. cost  function,  or whatever sensitivity measure is desired to be
  1473. used for reannealing) to be returned to  asa().   An  example  is
  1474. provided with the ASA_TEMPLATE for ASA_SAMPLE.
  1475.  
  1476. 7.3.29.  OPTIONS->CURVATURE_0[FALSE]
  1477.  
  1478.      If  the  curvature array is quite large for your system, and
  1479. you really do not use this information, you can  set  CURVATURE_0
  1480. to  TRUE which just requires a one-dimensional curvature[0] to be
  1481. defined to pass to the asa module (to avoid  problems  with  some
  1482. systems).   This is most useful, and typically is necessary, when
  1483. minimizing systems with large numbers  of  parameters  since  the
  1484. curvature array is of size number of parameters squared.
  1485.  
  1486.      If  you  wish to calculate the curvature array periodically,
  1487. every        reannealing        cycle        determined        by
  1488. OPTIONS->TESTING_FREQUENCY_MODULUS, then set OPTIONS->CURVATURE_0
  1489. to -1.
  1490.  
  1491. 7.3.30.  OPTIONS->QUENCH_PARAMETERS[FALSE]
  1492.  
  1493.      This Program Option permits you to alter the basic algorithm
  1494. to   perform  selective  "quenching,"  i.e.,  faster  temperature
  1495. cooling than permitted by the ASA algorithm.  This  can  be  very
  1496. useful,  e.g.,  to  quench  the  system  down  to  some region of
  1497. interest, and then to perform proper annealing for  the  rest  of
  1498. the  run.   However,  note  that once you decide to quench rather
  1499. than  to  truly  anneal,  there  no  longer  is  any  statistical
  1500. guarantee  of  finding  a  global optimum.  Furthermore, once you
  1501. decide to quench there are many more alternative  algorithms  you
  1502. might wish to choose for your system.
  1503.  
  1504.      Setting QUENCH_PARAMETERS to TRUE can be extremely useful in
  1505. very large parameter dimensions.  As discussed in the first  1989
  1506. VFSR paper, the heuristic statistical proof of finding the global
  1507. optimum reduces  to  the  following:  The  parameter  temperature
  1508. schedules  must  suffice to insure that the product of individual
  1509. generating distributions,
  1510.         g = PROD_i g^i,
  1511. taken at all annealing times, indexed by k, of not  generating  a
  1512. global optimum, given infinite time, is such that
  1513.  
  1514.  
  1515.  
  1516.                               - 22 -
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  1523.  
  1524.  
  1525.         PROD_k (1-g_k) = 0,
  1526. which is equivalent to
  1527.         SUM_k g_k = infinity.
  1528. For the ASA temperature schedule, this is satisfied as
  1529.         SUM_k PROD^D 1/k^(1/D) = SUM_k 1/k = infinity.
  1530. Now, if the temperature schedule above is redefined as
  1531.         T_i(k_i) = T_0i exp(-c_i k_i^(Q/D)),
  1532.         c_i = m_i exp(-n_i Q/D),
  1533. in  terms of the "quenching factor" Q, then the above proof fails
  1534. if Q > 1 as
  1535.         SUM_k PROD^D 1/k^(Q/D) = SUM_k 1/k^Q < infinity
  1536.  
  1537.      This  simple   calculation   shows   how   the   "curse   of
  1538. dimensionality"  arises,  and also gives a possible way of living
  1539. with this disease which will be present  in  any  algorithm  that
  1540. substantially samples the parameter space.  In ASA, the influence
  1541. of large dimensions becomes clearly focussed on  the  exponential
  1542. of  the  power  of  k  being  1/D,  as  the annealing required to
  1543. properly sample the space becomes prohibitively slow.  So, if  we
  1544. cannot commit resources to properly sample the space ergodically,
  1545. then for some systems perhaps the next best procedure would be to
  1546. turn  on quenching, whereby Q can become on the order of the size
  1547. of number of dimensions.  In some cases tried, a small system  of
  1548. only  a  few  parameters can be used to determine some reasonable
  1549. Program Options, and then these can be used  for  a  much  larger
  1550. space  scaled up to many parameters.  This can work in some cases
  1551. because of  the  independence  of  dimension  of  the  generating
  1552. functions.
  1553.  
  1554. 7.3.31.  OPTIONS->user_quench_param_scale
  1555.  
  1556.      If     QUENCH_PARAMETERS     is     TRUE,     a     pointer,
  1557. OPTIONS->user_quench_param_scale, is used to adaptively  set  the
  1558. scale  of  the  temperature schedule.  If this choice is elected,
  1559. then  OPTIONS->user_quench_param_scale[]  must   be   initialized
  1560. (named   USER_OPTIONS->user_quench_param_scale[]   in   the  user
  1561. module),  and   values   defined   for   each   dimension.    (If
  1562. QUENCH_PARAMETERS      is     FALSE,     then     the     pointer
  1563. *user_quench_param_scale must be included  in  *OPTIONS,  but  it
  1564. need  not  be  initialized.)  The default in the asa module is to
  1565. assign the annealing value of 1 to all  elements  that  might  be
  1566. defined  otherwise.   If values are selected greater than 1 using
  1567. this Program Option, then quenching is enforced.
  1568.  
  1569. 7.3.32.  OPTIONS->QUENCH_COST[FALSE]
  1570.  
  1571.      If QUENCH_COST is set to TRUE, the scale of the power of 1/D
  1572. temperature  schedule  used  for  the  acceptance function can be
  1573. altered in  a  similar  fashion  to  that  described  above  when
  1574. QUENCH_PARAMETERS is set to TRUE.  However, note that this OPTION
  1575. does not affect the annealing proof of ASA, and so this may  used
  1576. without  damaging  the  statistical  ergodicity of the algorithm.
  1577. Even greater functional changes can be made using the Pre-Compile
  1578. DEFINE_OPTIONS USER_COST_SCHEDULE.
  1579.  
  1580.  
  1581.  
  1582.                               - 23 -
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  1589.  
  1590.  
  1591. 7.3.33.  OPTIONS->user_quench_cost_scale
  1592.  
  1593.      If       QUENCH_COST      is      TRUE,      a      pointer,
  1594. OPTIONS->user_quench_cost_scale, is used to  adaptively  set  the
  1595. scale  of  the  temperature schedule.  If this choice is elected,
  1596. then  OPTIONS->user_quench_cost_scale[0]  must   be   initialized
  1597. (named   USER_OPTIONS->user_quench_cost_scale[0]   in   the  user
  1598. module).   (If   QUENCH_COST   is   FALSE,   then   the   pointer
  1599. *user_quench_cost_scale must be included in *OPTIONS, but it need
  1600. not be initialized.)  The default in the asa module is to  assign
  1601. the  annealing  value  of 1 to this element that might be defined
  1602. otherwise.
  1603.  
  1604.      OPTIONS->user_quench_cost_scale may  be  changed  adaptively
  1605. without  affecting the ergodicity of the algorithm, within reason
  1606. of course.  This might be useful for some  systems  that  require
  1607. different  approaches to the cost function in different ranges of
  1608. its parameters.  Note that increasing this parameter  beyond  its
  1609. default  of  1.0 can result in rapidly locking in the search to a
  1610. small region of the  cost  function,  severely  handicapping  the
  1611. algorithm.   On  the contrary, you may find that slowing the cost
  1612. temperature schedule, by setting this parameter to a  value  less
  1613. than 1.0, may work better for your system.
  1614.  
  1615. 7.3.34.  OPTIONS->asa_data
  1616.  
  1617.      If  the  Pre-Compile  Option  OPTIONAL_DATA[FALSE] is set to
  1618. TRUE, an additional Program  Option  pointer,  OPTIONS->asa_data,
  1619. becomes available to to return additional information to the user
  1620. module from the asa module.  This information  communicates  with
  1621. the  asa  module, and memory must be allocated for it in the user
  1622. module.  An example is given  in  user.c  when  SELF_OPTIMIZE  is
  1623. TRUE.
  1624.  
  1625. 7.3.35.  OPTIONS->asa_out_file
  1626.  
  1627.      If you wish to have the printing from the asa module be sent
  1628. to a file determined dynamically from the user  module,  set  the
  1629. Pre-Compile  Printing  Option  USER_ASA_OUT[FALSE]  to  TRUE, and
  1630. define the Program  Option  *asa_out_file  in  the  user  module.
  1631. (This  overrides  any  ASA_OUT settings.)  An example of this use
  1632. for multiple asa() runs is given in the user module.
  1633.  
  1634. 7.3.36.  OPTIONS->cost_schedule
  1635.  
  1636.      If  USER_COST_SCHEDULE[FALSE]   is   set   to   TRUE,   then
  1637. (*cost_schedule)  ()  is  created  as  a  pointer to the function
  1638. user_cost_schedule() in user.c, and to recur_user_cost_schedule()
  1639. if SELF_OPTIMIZE is set to TRUE.
  1640.  
  1641. 7.3.37.  OPTIONS->reanneal_function
  1642.  
  1643.      If   USER_REANNEAL_FUNCTION[FALSE]  is  set  to  TRUE,  then
  1644. (*reanneal_function) () is created as a pointer to  the  function
  1645.  
  1646.  
  1647.  
  1648.                               - 24 -
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  1655.  
  1656.  
  1657. user_reanneal()   in  user.c,  and  to  recur_user_reanneal()  if
  1658. SELF_OPTIMIZE is set to TRUE.
  1659.  
  1660. 7.3.38.  OPTIONS->n_accepted
  1661.  
  1662.      If ASA_SAMPLE  is  set  to  TRUE,  n_accepted  contains  the
  1663. current  number of points saved by the acceptance criteria.  This
  1664. can be used to monitor the sampling.
  1665.  
  1666. 7.3.39.  OPTIONS->bias_acceptance
  1667.  
  1668.      If ASA_SAMPLE is TRUE, this is the bias of the current state
  1669. from the Boltzmann acceptance test described above.
  1670.  
  1671. 7.3.40.  OPTIONS->bias_generated
  1672.  
  1673.      If  ASA_SAMPLE  is TRUE, a pointer, OPTIONS->bias_generated,
  1674. contains the the biases of the current state from the  generating
  1675. distributions   of   all   active  parameters,  described  above.
  1676. OPTIONS->bias_generated[] must be initialized in the user module.
  1677.  
  1678. 7.3.41.  OPTIONS->average_weights
  1679.  
  1680.      IF  ASA_SAMPLE  is TRUE, this is the average of the weight[]
  1681. array  holding  the  products  of  the  inverse  asa   generating
  1682. distributions of all active parameters.
  1683.  
  1684.      For  example,  OPTIONS->n_accepted  can  be  used to monitor
  1685. changes in a new saved point  in  the  cost  function,  and  when
  1686. OPTIONS->average_weights  reaches  a  specified  number  (perhaps
  1687. repeated several  times),  the  cost  function  could  return  an
  1688. invalid  flag  from the cost function to terminate the run.  When
  1689. the average_weights is very small, then additional sampled points
  1690. likely will not substantially contribute more information.
  1691.  
  1692. 7.3.42.  OPTIONS->limit_weights
  1693.  
  1694.      If  ASA_SAMPLE  is  set to TRUE, limit_weights is a limit on
  1695. the value of the  average  of  the  weight[]  array  holding  the
  1696. inverse  asa  generating  distribution.  When this lower limit is
  1697. crossed, asa will no longer send sampling output  to  be  printed
  1698. out,   although   it  still  will  be  calculated.   As  the  run
  1699. progresses, this average will decrease until  contributions  from
  1700. further sampling become relatively unimportant.
  1701.  
  1702. 7.3.43.  OPTIONS->gener_mov_avr
  1703.  
  1704.      If ASA_PARALLEL is set to TRUE, gener_mov_avr determines the
  1705. window of the moving  average  of  sizes  of  parallel  generated
  1706. states  required  to find new best accepted states.  A reasonable
  1707. number for many problems is 3.
  1708.  
  1709.      If  and  when  OPTIONS->gener_mov_avr  is  set  to  0,  then
  1710. OPTIONS->gener_block is not changed thereafter.
  1711.  
  1712.  
  1713.  
  1714.                               - 25 -
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  1721.  
  1722.  
  1723. 7.3.44.  OPTIONS->gener_block_max
  1724.  
  1725.      If  ASA_PARALLEL  is  set to TRUE, gener_block is an initial
  1726. block size of parallel generated states to calculate to determine
  1727. a new best accepted state.
  1728.  
  1729. 7.3.45.  OPTIONS->gener_block_max
  1730.  
  1731.      If  ASA_PARALLEL  is  set  to  TRUE,  gener_block_max  is an
  1732. initial maximum  block  size  of  parallel  generated  states  to
  1733. calculate  to  determine  a new best accepted state.  This can be
  1734. changed adaptively during the run.
  1735.  
  1736.      This can  be  useful  if  your  parallel  code  assigns  new
  1737. processors  "on  the  fly," to compensate for some cost functions
  1738. being more CPU intensive, e.g., due to boundary conditions,  etc.
  1739. Then  OPTIONS->gener_block_max  may  be larger than the number of
  1740. physical processors, e.g., if OPTIONS->gener_block would call for
  1741. such a size.
  1742.  
  1743. 8.  User Module
  1744.  
  1745.      This  module  includes  user.c, user.h, and asa_user.h.  You
  1746. may wish to combine them into one file, or you may  wish  to  use
  1747. the ASA module as one component of a library required for a large
  1748. project.
  1749.  
  1750. 8.1.  int main(int argc, char **argv) | int asa_main()
  1751.  
  1752.      In   main(),   set   up  your  initializations  and  calling
  1753. statements to asa.  The files user.c and user.h provide a  sample
  1754. program,  as well as a sample cost function for your convenience.
  1755. If you do not intend to pass parameters into main, then  you  can
  1756. just  declare  it  as main() without the argc and argv arguments,
  1757. deleting other references to argc and argv.
  1758.  
  1759.      If ASA_LIB is set to TRUE, then  asa_main()  is  used  as  a
  1760. function call instead of main().
  1761.  
  1762.      If   SELF_OPTIMIZE   is   set   to   TRUE,  then  the  first
  1763. main()/asa_main() in  user.c  is  closed  off,  and  a  different
  1764. main()/asa_main() procedure in user.c is used.
  1765.  
  1766. 8.2.  void initialize_parameters(
  1767.           double *cost_parameters,
  1768.           double *parameter_lower_bound,
  1769.           double *parameter_upper_bound,
  1770.           double *cost_tangents,
  1771.           double *cost_curvature,
  1772.           ALLOC_INT *parameter_dimension,
  1773.           int *parameter_int_real,
  1774.           USER_DEFINES * USER_OPTIONS)
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.                               - 26 -
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  1787.  
  1788.  
  1789.      Before  calling  asa,  the  user  must  allocate storage and
  1790. initialize some of the passed parameters.  A sample procedure  is
  1791. provided  as  a  template.   In  this  procedure  the user should
  1792. allocate storage for the passed arrays and define the minimum and
  1793. maximum  values.  Below is detailed all the parameters which must
  1794. be initialized.  If your arrays are of size 1, still use them  as
  1795. arrays as described in user.c.  Alternatively, if you define `int
  1796. user_flag', then pass &user_flag.
  1797.  
  1798.      As written above, these are  the  names  used  in  the  user
  1799. module.   All  these  parameters  could be passed globally in the
  1800. user module, e.g., by defining  them  in  user.h  instead  of  in
  1801. main()  in  user.c,  but  since  the asa module only passes local
  1802. parameters to facilitate recursive use, this  approach  is  taken
  1803. here as well.
  1804.  
  1805. 8.3.  void recur_initialize_parameters(
  1806.           double *recur_cost_parameters,
  1807.           double *recur_parameter_lower_bound,
  1808.           double *recur_parameter_upper_bound,
  1809.           double *recur_cost_tangents,
  1810.           double *recur_cost_curvature,
  1811.           ALLOC_INT *recur_parameter_dimension,
  1812.           int *recur_parameter_int_real,
  1813.           USER_DEFINES * RECUR_USER_OPTIONS)
  1814.  
  1815.      This procedure is used only if SELF_OPTIMIZE is TRUE, and is
  1816. constructed similar to initialize_parameters().
  1817.  
  1818. 8.4.  double user_cost_function(
  1819.           double *x,
  1820.           double *parameter_minimum,
  1821.           double *parameter_maximum,
  1822.           double *tangents,
  1823.           double *curvature,
  1824.           ALLOC_INT *number_parameters,
  1825.           int *parameter_type,
  1826.           int *valid_state_generated_flag,
  1827.           int *exit_status,
  1828.           USER_DEFINES *OPTIONS)
  1829.  
  1830.  
  1831. 8.4.1.  user_cost_function
  1832.  
  1833.      You can give any name to user_cost_function as long  as  you
  1834. pass  this  name  to  asa; it is called cost_function in the user
  1835. module.  This function  returns  a  real  value  which  ASA  will
  1836. minimize.    In  cases  where  it  seems  that  the  ASA  default
  1837. parameters are not very efficient  for  your  system,  you  might
  1838. consider  modifying  the  cost  function  being  optimized.   For
  1839. example, if your actual cost  function  is  of  the  form  of  an
  1840. exponential  to  an  exponential,  you  might do better using the
  1841. logarithm of this as user_cost_function.
  1842.  
  1843.  
  1844.  
  1845.  
  1846.                               - 27 -
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  1853.  
  1854.  
  1855. 8.4.2.  *x
  1856.  
  1857.      x (called cost_parameters in the user module) is an array of
  1858. doubles representing a set of parameters to evaluate.
  1859.  
  1860. 8.4.3.  double *parameter_minimum
  1861.  
  1862.  
  1863. 8.4.4.  double *parameter_maximum
  1864.  
  1865.      These  two  arrays  of  doubles are passed.  Since ASA works
  1866. only on bounded search spaces, these arrays  should  contain  the
  1867. minimum  and  maximum  values  each parameter can attain.  If you
  1868. aren't sure, try a factor of  10  or  100  times  any  reasonable
  1869. values.   The  exponential  temperature annealing schedule should
  1870. quickly sharpen the search down to the most important region.
  1871.  
  1872.      Passing the parameter bounds in the  cost  function  permits
  1873. some   additional  adaptive  features  during  the  search.   For
  1874. example, setting the lower bound equal to the  upper  bound  will
  1875. remove  a parameter from consideration.  In the user module these
  1876. bounds are named parameter_lower_bound and parameter_upper_bound.
  1877.  
  1878. 8.4.5.  double *tangents
  1879.  
  1880.      This  array  of  doubles is passed.  On return from asa this
  1881. contains the first derivatives of the cost function with  respect
  1882. to its parameters.  These can be useful for determining the value
  1883. of your fit.  In this implementation of  ASA,  the  tangents  are
  1884. used to determine the relative reannealing among parameters.
  1885.  
  1886. 8.4.6.  double *curvature
  1887.  
  1888.      This  array  of doubles is passed next.  On return from asa,
  1889. for real parameters, this contains the second derivatives of  the
  1890. cost  function with respect to its parameters.  These also can be
  1891. useful for determining the value of your fit.
  1892.  
  1893.      When the DEFINE_OPTIONS CURVATURE_0 option is  set  to  TRUE
  1894. the  curvature calculations are bypassed.  This can be useful for
  1895. very large spaces.
  1896.  
  1897. 8.4.7.  ALLOC_INT *number_parameters
  1898.  
  1899.      An integer containing the dimensionality of the state  space
  1900. is  passed  next (called parameter_dimension in the user module).
  1901. (If    you    define    `ALLOC_INT    number_parameters',    pass
  1902. &number_parameters.) The arrays x (representing cost_parameters),
  1903. parameter_lower_bound, parameter_upper_bound, cost_tangents,  and
  1904. parameter_int_real    (below)    are    to   be   of   the   size
  1905. *number_parameters.  The array curvature which may be of size the
  1906. square of *number_parameters.
  1907.  
  1908.  
  1909.  
  1910.  
  1911.  
  1912.                               - 28 -
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  1919.  
  1920.  
  1921. 8.4.8.  int *parameter_type
  1922.  
  1923.      This    integer    array   is   passed   next   (passed   as
  1924. parameter_int_real in the user module).   Each  element  of  this
  1925. array   (each  flag)  can  be:  REAL_TYPE  (-1)  (indicating  the
  1926. parameter is a real  value),  INTEGER_TYPE  (1)  (indicating  the
  1927. parameter  can  take  on  only  integer values), REAL_NO_REANNEAL
  1928. (-2), or INTEGER_NO_REANNEAL (2).  The latter two choices signify
  1929. that  no  derivatives  are  to  be  taken  with  respect to these
  1930. parameters.   For  example,  this  can  be  useful   to   exclude
  1931. discontinuous functions from being reannealed.
  1932.  
  1933. 8.4.9.  *valid_state_generated_flag
  1934.  
  1935.      valid_state_generated_flag  is  the  address  of an integer,
  1936. named cost_flag in the  user  module.   In  user_cost_function(),
  1937. *cost_flag should be set to FALSE (0) if the parameters violate a
  1938. set of user defined constraints (e.g., as defined  by  a  set  of
  1939. boundary  conditions)  or  TRUE (1) if the parameters represent a
  1940. valid state.  If *cost_flag is returned to  asa()  as  FALSE,  no
  1941. acceptance  test  will  be  attempted,  and  a  new  set of trial
  1942. parameters will be generated.
  1943.  
  1944.      If  another  algorithm  suggests  a  way  of   incorporating
  1945. constraints  into  the  cost  function,  then  this modified cost
  1946. function can be used as well by ASA, or that algorithm might best
  1947. be used a front-end to ASA.
  1948.  
  1949.      If  OPTIONS->USER_TANGENTS[FALSE] has been set to TRUE, then
  1950. asa()   expects   the    user    to    test    the    value    of
  1951. *valid_state_generated_flag   that   enters   from   asa().    If
  1952. *valid_state_generated_flag enters with a value  of  FALSE,  then
  1953. the  user  is  expected to calculate the tangents[] array (called
  1954. cost_tangents[]  in  ASA_TEST  in  user.c)  before  exiting  that
  1955. particular  evaluation  of  the  cost  function.   An  example is
  1956. provided with the ASA_TEMPLATE for ASA_SAMPLE.
  1957.  
  1958. 8.4.10.  int *exit_status
  1959.  
  1960.      The address of this integer is passed to asa.  On return  it
  1961. contains the code for the reason asa exited.
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.                               - 29 -
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  1985.  
  1986.  
  1987.      NORMAL_EXIT = 0.  Given the criteria set largely by the
  1988.      DEFINE_OPTIONS, the search has run its normal course.
  1989.  
  1990.      P_TEMP_TOO_SMALL = 1.  A parameter temperature was  too
  1991.      small  using  the  set  criteria.   Often  this  is  an
  1992.      acceptable status code.  You  can  omit  this  test  by
  1993.      setting  NO_PARAM_TEMP_TEST to TRUE as one of your Pre-
  1994.      Compile  Options;  then   values   of   the   parameter
  1995.      temperatures   less   than   EPS_DOUBLE   are   set  to
  1996.      EPS_DOUBLE.
  1997.  
  1998.      C_TEMP_TOO_SMALL = 2.  The  cost  temperature  was  too
  1999.      small  using  the  set  criteria.   Often  this  is  an
  2000.      acceptable status code.  You  can  omit  this  test  by
  2001.      setting  NO_COST_TEMP_TEST  to TRUE as one of your Pre-
  2002.      Compile Options; then a value of the  cost  temperature
  2003.      less than EPS_DOUBLE is set to EPS_DOUBLE.
  2004.  
  2005.      COST_REPEATING = 3.  The cost function value repeated a
  2006.      number of times using the set criteria.  Often this  is
  2007.      an acceptable status code.
  2008.  
  2009.      TOO_MANY_INVALID_STATES   =  4.   Too  many  repetitive
  2010.      generated states were invalid using the  set  criteria.
  2011.      This  is  helpful  when  using *cost_flag, as discussed
  2012.      above, to include constraints.
  2013.  
  2014.      An exit code of 9, defined by exit(9), has been set in  case
  2015. any  of  the  calloc  memory  allocations  fails.  Note that just
  2016. relying on such a simple summary given  by  *exit_status  can  be
  2017. extremely deceptive, especially in highly nonlinear problems.  It
  2018. is strongly suggested that the user set ASA_PRINT=TRUE before any
  2019. production  runs.   An examination of some periodic output of ASA
  2020. can be essential to its proper use.
  2021.  
  2022. 8.4.11.  USER_DEFINES *OPTIONS
  2023.  
  2024.      All Program Options are defined in  this  structure.   Since
  2025. Program  Options  are  passed to asa and the cost function, these
  2026. may be changed adaptively.
  2027.  
  2028.      The Program Options also can be read in from a separate data
  2029. file,  asa_opt,  permitting  efficient  tuning/debugging of these
  2030. parameters without having to recompile the code.  This option has
  2031. been added to the asa module.
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.                               - 30 -
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  2051.  
  2052.  
  2053. 8.5.  double recur_cost_function(
  2054.           double *recur_cost_parameters,
  2055.           double *recur_parameter_lower_bound,
  2056.           double *recur_parameter_upper_bound,
  2057.           double *recur_cost_tangents,
  2058.           double *recur_cost_curvature,
  2059.           int *recur_parameter_dimension,
  2060.           int *recur_parameter_int_real,
  2061.           int *recur_cost_flag,
  2062.           int *recur_exit_code,
  2063.           USER_DEFINES * RECUR_USER_OPTIONS)
  2064.  
  2065.      This procedure is used only if SELF_OPTIMIZE is TRUE, and is
  2066. constructed similar to cost_function().
  2067.  
  2068. 8.6.  double user_random_generator()
  2069.  
  2070.      A random number generator function must be selected.  It may
  2071. be as simple as one of the UNIX(R) random number generators (e.g.
  2072. drand48), or may be user defined, but it  should  return  a  real
  2073. value  within  [0,1)  and not take any parameters.  A good random
  2074. number  generator,  randflt,  and  its  auxiliary  routines   are
  2075. provided with the code in the user module.
  2076.  
  2077. 8.7.  void initialize_rng()
  2078.  
  2079.      Most  random  number  generators  should  be  "warmed-up" by
  2080. calling a set of dummy random numbers.
  2081.  
  2082. 8.8.  double user_cost_schedule(
  2083.           double test_temperature,
  2084.           USER_DEFINES * USER_OPTIONS);
  2085.  
  2086.      If USER_COST_SCHEDULE[FALSE]  is  set  to  TRUE,  then  this
  2087. function  must  define how the new cost temperature is calculated
  2088. during  the  acceptance  test.   The   default   is   to   return
  2089. test_temperature.   For  example, if you sense that the search is
  2090. spending too much time in local minima at some stage  of  search,
  2091. e.g., dependent on information gathered in USER_OPTIONS, then you
  2092. might return the square root of test_temperature, or  some  other
  2093. function,  to  slow  down  the  sharpening  of  the cost function
  2094. acceptance test.
  2095.  
  2096. 8.9.  double recur_user_cost_schedule(
  2097.           double test_temperature,
  2098.           USER_DEFINES * RECUR_USER_OPTIONS);
  2099.  
  2100.      If USER_COST_SCHEDULE[FALSE] and  SELF_OPTIMIZE[FALSE]  both
  2101. are  set to TRUE, then this function must define how the new cost
  2102. temperature  is  calculated  during  the  acceptance  test.    As
  2103. discussed  above  for  user_cost_schedule(),  you  may modify the
  2104. default value of  test_temperature  returned  by  this  function,
  2105. e.g., dependent on information gathered in RECUR_USER_OPTIONS.
  2106.  
  2107.  
  2108.  
  2109.  
  2110.                               - 31 -
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  2117.  
  2118.  
  2119. 8.10.  double user_reanneal(
  2120.           double current_temp,
  2121.           double tangent,
  2122.           double max_tangent,
  2123.           USER_DEFINES * USER_OPTIONS);
  2124.  
  2125.      If  USER_REANNEAL_FUNCTION[FALSE]  is set to TRUE, then this
  2126. function must define how the new temperature is calculated during
  2127. reannealing.
  2128.  
  2129. 8.11.  double recur_user_reanneal(
  2130.           double current_temp,
  2131.           double tangent,
  2132.           double max_tangent,
  2133.           USER_DEFINES * RECUR_USER_OPTIONS);
  2134.  
  2135.      If  USER_REANNEAL_FUNCTION[FALSE]  and  SELF_OPTIMIZE[FALSE]
  2136. both are set to TRUE, then this function must define how the  new
  2137. temperature is calculated during reannealing.
  2138.  
  2139. 8.12.  final_cost = asa(
  2140.           cost_function,
  2141.           randflt,
  2142.           cost_parameters,
  2143.           parameter_lower_bound,
  2144.           parameter_upper_bound,
  2145.           cost_tangents,
  2146.           cost_curvature,
  2147.           parameter_dimension,
  2148.           parameter_int_real,
  2149.           cost_flag,
  2150.           exit_code,
  2151.           USER_OPTIONS);
  2152.  
  2153.      This  is  the form of the call to asa from user.c.  A double
  2154. is returned to the calling program as whatever it is named by the
  2155. user,  e.g., final_cost.  It will be the minimum cost value found
  2156. by asa.
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.                               - 32 -
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  2183.  
  2184.  
  2185. 8.13.  double asa(
  2186.           double (*user_cost_function) (
  2187.                double *, double *, double *, double *, double *,
  2188.                ALLOC_INT *, int *, int *, int *, USER_DEFINES *),
  2189.           double (*user_random_generator) (void),
  2190.           double *parameter_initial_final,
  2191.           double *parameter_minimum,
  2192.           double *parameter_maximum,
  2193.           double *tangents,
  2194.           double *curvature,
  2195.           ALLOC_INT *number_parameters,
  2196.           int *parameter_type,
  2197.           int *valid_state_generated_flag,
  2198.           int *exit_status,
  2199.           USER_DEFINES * OPTIONS)
  2200.  
  2201.      This is how asa is defined in the ASA module,  contained  in
  2202. asa.c   and   asa_user.h.    All   but   the  user_cost_function,
  2203. user_random_generator,  and  parameter_initial_final   parameters
  2204. have   been   described   above   as  they  also  are  passed  by
  2205. user_cost_function().
  2206.  
  2207. 8.13.1.  double (*user_cost_function) ()
  2208.  
  2209.      The parameter (*user_cost_function*) () is a pointer to  the
  2210. cost function that you defined in your user module.
  2211.  
  2212. 8.13.2.  double (*user_random_generator) ()
  2213.  
  2214.      A pointer to the random number generator  function,  defined
  2215. in the user module, must be passed next.
  2216.  
  2217. 8.13.3.  double *parameter_initial_final
  2218.  
  2219.      An  array of doubles is passed (passed as cost_parameters in
  2220. the user  module).   Initially,  this  array  holds  the  set  of
  2221. starting  parameters  which  should  satisfy  any  constraints or
  2222. boundary conditions.  Upon return from  the  asa  procedure,  the
  2223. array  will  contain  the  best set of parameters found by asa to
  2224. minimize the user's cost function.   Experience  shows  that  any
  2225. guesses  within  the  acceptable  ranges  should  suffice,  since
  2226. initially the system is at high  annealing  temperature  and  ASA
  2227. samples  the  breadth  of the ranges.  The default is to have asa
  2228. generate a  set  of  initial  parameters  satisfying  the  user's
  2229. constraints.       This      can      be     overridden     using
  2230. USER_INITIAL_PARAMETERS=TRUE, to have the user's initial guess be
  2231. the first generated set of parameters.
  2232.  
  2233. 8.14.  void print_time(char *message, FILE * ptr_out)
  2234.  
  2235.      As a convenience, this subroutine and its auxiliary  routine
  2236. aux_print_time  are  provided  in asa.c to keep track of the time
  2237. spent during optimization.  Templates in the code are provided to
  2238. use  these routines to print to output from both the asa and user
  2239.  
  2240.  
  2241.  
  2242.                               - 33 -
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  2249.  
  2250.  
  2251. modules.  These routines can give some  compilation  problems  on
  2252. some   platforms,   and   may   be  bypassed  using  one  of  the
  2253. DEFINE_OPTIONS.  It takes as its parameters a string  which  will
  2254. be  printed  and  the  pointer  to  file to where the printout is
  2255. directed.   An  example  is  given   in   user_cost_function   to
  2256. illustrate  how  print_time  may be called periodically every set
  2257. number of calls by defining PRINT_FREQUENCY in user.h.   See  the
  2258. NOTES  file for changes in these routines that may be required on
  2259. some particular systems.
  2260.  
  2261. 8.15.  void sample(FILE * ptr_out, FILE * ptr_asa)
  2262.  
  2263.      When ASA_TEMPLATE and ASA_SAMPLE are set to true, using data
  2264. collected in the ASA_OUT file, this routine  illustrates  how  to
  2265. extract  the  data stored in the ASA_OUT file and print it to the
  2266. user module.
  2267.  
  2268. 9.  Bug Reports
  2269.  
  2270.      I volunteer my time  to  make  every  reasonable  effort  to
  2271. maintain  only  current versions of the asa module, to permit the
  2272. code to compile without "error," not necessarily without compiler
  2273. "warnings."   The  user  module  is  offered  only  as a guide to
  2274. accessing the asa module.  The NOTES file  will  contain  updates
  2275. for  some  standard  machines.   I  welcome  your bug reports and
  2276. constructive critiques regarding this code.  If  you  are  having
  2277. problems,  it  might  help  if you enclose relevant portions your
  2278. ASA_OUT file.
  2279.  
  2280.      "Flames" will be rapidly quenched.
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.                               - 34 -
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  2315.  
  2316.  
  2317. 10.  References
  2318.  
  2319. [1]  L.   Ingber,   "Adaptive   Simulated    Annealing    (ASA),"
  2320.      [ftp.alumni.caltech.edu:  /pub/ingber/ASA-shar,  ASA-shar.Z,
  2321.      ASA.tar.Z, ASA.tar.gz,  ASA.zip],  Lester  Ingber  Research,
  2322.      McLean, VA (1993).
  2323.  
  2324. [2]  L.   Ingber,  "Very  fast  simulated  re-annealing,"  Mathl.
  2325.      Comput. Modelling, 12, pp. 967-973 (1989).
  2326.  
  2327. [3]  L.  Ingber,  H.  Fujio,  and  M.F.   Wehner,   "Mathematical
  2328.      comparison  of  combat  computer  models  to exercise data,"
  2329.      Mathl. Comput. Modelling, 15, pp. 65-90 (1991).
  2330.  
  2331. [4]  L. Ingber, "Statistical mechanical aids to calculating  term
  2332.      structure models," Phys. Rev. A, 42, pp. 7057-7064 (1990).
  2333.  
  2334. [5]  L.    Ingber,    "Statistical   mechanics   of   neocortical
  2335.      interactions:    A    scaling    paradigm     applied     to
  2336.      electroencephalography,"  Phys.  Rev.  A,  44, pp. 4017-4060
  2337.      (1991).
  2338.  
  2339. [6]  L. Ingber, "Generic  mesoscopic  neural  networks  based  on
  2340.      statistical  mechanics  of  neocortical interactions," Phys.
  2341.      Rev. A, 45, pp. R2183-R2186 (1992).
  2342.  
  2343. [7]  L. Ingber and B. Rosen,  "Very  Fast  Simulated  Reannealing
  2344.      (VFSR)," [ringer.cs.utsa.edu: /pub/rosen/vfsr.Z], University
  2345.      of Texas, San Antonio, TX (1992).
  2346.  
  2347. [8]  L. Ingber, "Simulated annealing:  Practice  versus  theory,"
  2348.      Mathl. Comput. Modelling, 18, pp. 29-57 (1993).
  2349.  
  2350. [9]  M.   Wofsey,   "Technology:   Shortcut   tests  validity  of
  2351.      complicated formulas," The Wall Street Journal,  CCXXII,  p.
  2352.      B1 (24 September 1993).
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.  
  2374.                               - 35 -
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  2381.  
  2382.  
  2383.                         Table of Contents
  2384.  
  2385. 1.   GNU General Public License (GPL) . . . . . . . . . . . .   1
  2386.  
  2387. 2.   Documentation  . . . . . . . . . . . . . . . . . . . . .   1
  2388.  
  2389. 2.1.           Table of Contents  . . . . . . . . . . . . . .   1
  2390.  
  2391. 2.2.           readme.ms  . . . . . . . . . . . . . . . . . .   1
  2392.  
  2393. 2.3.           README and README+ . . . . . . . . . . . . . .   1
  2394.  
  2395. 2.4.           asa.[13nl] Manpage . . . . . . . . . . . . . .   1
  2396.  
  2397. 2.5.           README.ps  . . . . . . . . . . . . . . . . . .   1
  2398.  
  2399. 2.6.           Additional Documentation . . . . . . . . . . .   2
  2400.  
  2401. 2.7.           Parallelizing ASA and PATHINT Project
  2402. (PAPP)  . . . . . . . . . . . . . . . . . . . . . . . . . . .   2
  2403.  
  2404. 2.8.           Additional Information . . . . . . . . . . . .   2
  2405.  
  2406. 3.   Availability of ASA Code . . . . . . . . . . . . . . . .   2
  2407.  
  2408. 3.1.           Caltech  . . . . . . . . . . . . . . . . . . .   2
  2409.  
  2410. 3.2.           Electronic Mail  . . . . . . . . . . . . . . .   3
  2411.  
  2412. 3.3.           ASA Mailing List . . . . . . . . . . . . . . .   4
  2413.  
  2414. 4.   Background . . . . . . . . . . . . . . . . . . . . . . .   4
  2415.  
  2416. 4.1.           Context  . . . . . . . . . . . . . . . . . . .   4
  2417.  
  2418. 4.2.           Outline of ASA Algorithm . . . . . . . . . . .   4
  2419.  
  2420. 4.2.1.              Generating Probability Density Func-
  2421. tion  . . . . . . . . . . . . . . . . . . . . . . . . . . . .   4
  2422.  
  2423. 4.2.2.              Acceptance Probability Density Func-
  2424. tion  . . . . . . . . . . . . . . . . . . . . . . . . . . . .   5
  2425.  
  2426. 4.2.3.              Reannealing Temperature Schedule  . . . .   5
  2427.  
  2428. 4.3.           Efficiency Versus Necessity  . . . . . . . . .   5
  2429.  
  2430. 5.   Outline of Use . . . . . . . . . . . . . . . . . . . . .   6
  2431.  
  2432. 6.   Makefile/Compilation Procedures  . . . . . . . . . . . .   6
  2433.  
  2434. 7.   User Options . . . . . . . . . . . . . . . . . . . . . .   7
  2435.  
  2436. 7.1.           Pre-Compile DEFINE_OPTIONS . . . . . . . . . .   7
  2437.  
  2438.  
  2439.  
  2440.                               - ii -
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  2447.  
  2448.  
  2449. 7.1.1.              OPTIONS_FILE=TRUE . . . . . . . . . . . .   7
  2450.  
  2451. 7.1.2.              ASA_LIB=FALSE . . . . . . . . . . . . . .   8
  2452.  
  2453. 7.1.3.              HAVE_ANSI=TRUE  . . . . . . . . . . . . .   8
  2454.  
  2455. 7.1.4.              IO_PROTOTYPES=TRUE  . . . . . . . . . . .   8
  2456.  
  2457. 7.1.5.              TIME_CALC=FALSE . . . . . . . . . . . . .   8
  2458.  
  2459. 7.1.6.              TIME_STD=FALSE  . . . . . . . . . . . . .   8
  2460.  
  2461. 7.1.7.              INT_LONG=TRUE . . . . . . . . . . . . . .   8
  2462.  
  2463. 7.1.8.              INT_ALLOC=FALSE . . . . . . . . . . . . .   9
  2464.  
  2465. 7.1.9.              SMALL_FLOAT=1.0E-18 . . . . . . . . . . .   9
  2466.  
  2467. 7.1.10.             MIN_DOUBLE=SMALL_FLOAT  . . . . . . . . .   9
  2468.  
  2469. 7.1.11.             MAX_DOUBLE=1.0/SMALL_FLOAT  . . . . . . .   9
  2470.  
  2471. 7.1.12.             EPS_DOUBLE=SMALL_FLOAT  . . . . . . . . .   9
  2472.  
  2473. 7.1.13.             NO_PARAM_TEMP_TEST=FALSE  . . . . . . . .  10
  2474.  
  2475. 7.1.14.             NO_COST_TEMP_TEST=FALSE . . . . . . . . .  10
  2476.  
  2477. 7.1.15.             SELF_OPTIMIZE=FALSE . . . . . . . . . . .  10
  2478.  
  2479. 7.1.16.             ASA_TEST=FALSE  . . . . . . . . . . . . .  10
  2480.  
  2481. 7.1.17.             ASA_TEMPLATE=FALSE  . . . . . . . . . . .  11
  2482.  
  2483. 7.1.18.             OPTIONAL_DATA=FALSE . . . . . . . . . . .  11
  2484.  
  2485. 7.1.19.             USER_COST_SCHEDULE=FALSE  . . . . . . . .  11
  2486.  
  2487. 7.1.20.             USER_REANNEAL_FUNCTION=FALSE  . . . . . .  11
  2488.  
  2489. 7.1.21.             ASA_SAMPLE=FALSE  . . . . . . . . . . . .  12
  2490.  
  2491. 7.1.22.             ASA_PARALLEL=FALSE  . . . . . . . . . . .  12
  2492.  
  2493. 7.2.           Printing DEFINE_OPTIONS  . . . . . . . . . . .  13
  2494.  
  2495. 7.2.1.              ASA_PRINT=TRUE  . . . . . . . . . . . . .  13
  2496.  
  2497. 7.2.2.              ASA_OUT=\"asa_out\" . . . . . . . . . . .  13
  2498.  
  2499. 7.2.3.              USER_ASA_OUT=FALSE  . . . . . . . . . . .  13
  2500.  
  2501. 7.2.4.              ASA_PRINT_INTERMED=TRUE . . . . . . . . .  13
  2502.  
  2503.  
  2504.  
  2505.  
  2506.                              - iii -
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  2513.  
  2514.  
  2515. 7.2.5.              ASA_PRINT_MORE=FALSE  . . . . . . . . . .  14
  2516.  
  2517. 7.3.           Program OPTIONS  . . . . . . . . . . . . . . .  14
  2518.  
  2519. 7.3.1.              OPTIONS->LIMIT_ACCEPTANCES[10000] . . . .  16
  2520.  
  2521. 7.3.2.              OPTIONS->LIMIT_GENERATED[99999] . . . . .  16
  2522.  
  2523. 7.3.3.
  2524.              OPTIONS->LIMIT_INVALID_GENERATED_STATES[1000]
  2525. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  17
  2526.  
  2527. 7.3.4.
  2528.              OPTIONS->ACCEPTED_TO_GENERATED_RATIO[1.0E-6]
  2529. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  17
  2530.  
  2531. 7.3.5.              OPTIONS->COST_PRECISION[1.0E-18]  . . . .  17
  2532.  
  2533. 7.3.6.              OPTIONS->MAXIMUM_COST_REPEAT[5] . . . . .  17
  2534.  
  2535. 7.3.7.              OPTIONS->NUMBER_COST_SAMPLES[5] . . . . .  17
  2536.  
  2537. 7.3.8.
  2538.              OPTIONS->TEMPERATURE_RATIO_SCALE[1.0E-5] . . . .  17
  2539.  
  2540. 7.3.9.              OPTIONS->COST_PARAMETER_SCALE[1.0]  . . .  18
  2541.  
  2542. 7.3.10.
  2543.             OPTIONS->TEMPERATURE_ANNEAL_SCALE[100.0]  . . . .  18
  2544.  
  2545. 7.3.11.
  2546.             OPTIONS->USER_INITIAL_COST_TEMP[FALSE]  . . . . .  19
  2547.  
  2548. 7.3.12.             OPTIONS->user_cost_temperature  . . . . .  19
  2549.  
  2550. 7.3.13.
  2551.             OPTIONS->INCLUDE_INTEGER_PARAMETERS[FALSE]  . . .  19
  2552.  
  2553. 7.3.14.
  2554.             OPTIONS->USER_INITIAL_PARAMETERS[FALSE] . . . . .  19
  2555.  
  2556. 7.3.15.             OPTIONS->SEQUENTIAL_PARAMETERS[-1]  . . .  19
  2557.  
  2558. 7.3.16.
  2559.             OPTIONS->INITIAL_PARAMETER_TEMPERATURE[1.0]
  2560. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  20
  2561.  
  2562. 7.3.17.
  2563.             OPTIONS->RATIO_TEMPERATURE_SCALES[FALSE]  . . . .  20
  2564.  
  2565. 7.3.18.             OPTIONS->user_temperature_ratio . . . . .  20
  2566.  
  2567. 7.3.19.
  2568.             OPTIONS->USER_INITIAL_PARAMETERS_TEMPS[FALSE]
  2569.  
  2570.  
  2571.  
  2572.                               - iv -
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  2579.  
  2580.  
  2581. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  20
  2582.  
  2583. 7.3.20.             OPTIONS->user_parameter_temperature
  2584. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  20
  2585.  
  2586. 7.3.21.
  2587.             OPTIONS->TESTING_FREQUENCY_MODULUS[100] . . . . .  21
  2588.  
  2589. 7.3.22.             OPTIONS->ACTIVATE_REANNEAL[TRUE]  . . . .  21
  2590.  
  2591. 7.3.23.             OPTIONS->REANNEAL_RESCALE[10.0] . . . . .  21
  2592.  
  2593. 7.3.24.
  2594.             OPTIONS->MAXIMUM_REANNEAL_INDEX[50000]  . . . . .  21
  2595.  
  2596. 7.3.25.             OPTIONS->DELTA_X[0.001] . . . . . . . . .  21
  2597.  
  2598. 7.3.26.             OPTIONS->DELTA_PARAMETERS[FALSE]  . . . .  21
  2599.  
  2600. 7.3.27.             OPTIONS->user_delta_parameter . . . . . .  21
  2601.  
  2602. 7.3.28.             OPTIONS->USER_TANGENTS[FALSE] . . . . . .  22
  2603.  
  2604. 7.3.29.             OPTIONS->CURVATURE_0[FALSE] . . . . . . .  22
  2605.  
  2606. 7.3.30.             OPTIONS->QUENCH_PARAMETERS[FALSE] . . . .  22
  2607.  
  2608. 7.3.31.             OPTIONS->user_quench_param_scale  . . . .  23
  2609.  
  2610. 7.3.32.             OPTIONS->QUENCH_COST[FALSE] . . . . . . .  23
  2611.  
  2612. 7.3.33.             OPTIONS->user_quench_cost_scale . . . . .  24
  2613.  
  2614. 7.3.34.             OPTIONS->asa_data . . . . . . . . . . . .  24
  2615.  
  2616. 7.3.35.             OPTIONS->asa_out_file . . . . . . . . . .  24
  2617.  
  2618. 7.3.36.             OPTIONS->cost_schedule  . . . . . . . . .  24
  2619.  
  2620. 7.3.37.             OPTIONS->reanneal_function  . . . . . . .  24
  2621.  
  2622. 7.3.38.             OPTIONS->n_accepted . . . . . . . . . . .  25
  2623.  
  2624. 7.3.39.             OPTIONS->bias_acceptance  . . . . . . . .  25
  2625.  
  2626. 7.3.40.             OPTIONS->bias_generated . . . . . . . . .  25
  2627.  
  2628. 7.3.41.             OPTIONS->average_weights  . . . . . . . .  25
  2629.  
  2630. 7.3.42.             OPTIONS->limit_weights  . . . . . . . . .  25
  2631.  
  2632. 7.3.43.             OPTIONS->gener_mov_avr  . . . . . . . . .  25
  2633.  
  2634. 7.3.44.             OPTIONS->gener_block  . . . . . . . . . .  26
  2635.  
  2636.  
  2637.  
  2638.                               - v -
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  2645.  
  2646.  
  2647. 7.3.45.             OPTIONS->gener_block_max  . . . . . . . .  26
  2648.  
  2649. 8.   User Module  . . . . . . . . . . . . . . . . . . . . . .  26
  2650.  
  2651. 8.1.           int main(int argc, char **argv) | int
  2652. asa_main()  . . . . . . . . . . . . . . . . . . . . . . . . .  26
  2653.  
  2654. 8.2.           void initialize_parameters(  . . . . . . . . .  26
  2655.  
  2656. 8.3.           void recur_initialize_parameters(  . . . . . .  27
  2657.  
  2658. 8.4.           double user_cost_function( . . . . . . . . . .  27
  2659.  
  2660. 8.4.1.              user_cost_function  . . . . . . . . . . .  27
  2661.  
  2662. 8.4.2.              *x  . . . . . . . . . . . . . . . . . . .  28
  2663.  
  2664. 8.4.3.              double *parameter_minimum . . . . . . . .  28
  2665.  
  2666. 8.4.4.              double *parameter_maximum . . . . . . . .  28
  2667.  
  2668. 8.4.5.              double *tangents  . . . . . . . . . . . .  28
  2669.  
  2670. 8.4.6.              double *curvature . . . . . . . . . . . .  28
  2671.  
  2672. 8.4.7.              ALLOC_INT *number_parameters  . . . . . .  28
  2673.  
  2674. 8.4.8.              int *parameter_type . . . . . . . . . . .  29
  2675.  
  2676. 8.4.9.              *valid_state_generated_flag . . . . . . .  29
  2677.  
  2678. 8.4.10.             int *exit_status  . . . . . . . . . . . .  29
  2679.  
  2680. 8.4.11.             USER_DEFINES *OPTIONS . . . . . . . . . .  30
  2681.  
  2682. 8.5.           double recur_cost_function(  . . . . . . . . .  30
  2683.  
  2684. 8.6.           double user_random_generator() . . . . . . . .  31
  2685.  
  2686. 8.7.           void initialize_rng()  . . . . . . . . . . . .  31
  2687.  
  2688. 8.8.           double user_cost_schedule( . . . . . . . . . .  31
  2689.  
  2690. 8.9.           double recur_user_cost_schedule( . . . . . . .  31
  2691.  
  2692. 8.10.          double user_reanneal(  . . . . . . . . . . . .  31
  2693.  
  2694. 8.11.          double recur_user_reanneal(  . . . . . . . . .  32
  2695.  
  2696. 8.12.          final_cost = asa(  . . . . . . . . . . . . . .  32
  2697.  
  2698. 8.13.          double asa(  . . . . . . . . . . . . . . . . .  32
  2699.  
  2700. 8.13.1.             double (*user_cost_function) () . . . . .  33
  2701.  
  2702.  
  2703.  
  2704.                               - vi -
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710. Adaptive Simulated Annealing (ASA)                  Lester Ingber
  2711.  
  2712.  
  2713. 8.13.2.             double (*user_random_generator) ()  . . .  33
  2714.  
  2715. 8.13.3.             double *parameter_initial_final . . . . .  33
  2716.  
  2717. 8.14.          void print_time(char *message, FILE *
  2718. ptr_out)  . . . . . . . . . . . . . . . . . . . . . . . . . .  33
  2719.  
  2720. 8.15.          void sample(FILE * ptr_out, FILE *
  2721. ptr_asa)  . . . . . . . . . . . . . . . . . . . . . . . . . .  34
  2722.  
  2723. 9.   Bug Reports  . . . . . . . . . . . . . . . . . . . . . .  34
  2724.  
  2725. 10.  References . . . . . . . . . . . . . . . . . . . . . . .  34
  2726.  
  2727.  
  2728. $Id: readme.ms,v 4.2 1994/10/23 23:35:08 ingber Exp ingber $
  2729.  
  2730.  
  2731.  
  2732.  
  2733.  
  2734.  
  2735.  
  2736.  
  2737.  
  2738.  
  2739.  
  2740.  
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746.  
  2747.  
  2748.  
  2749.  
  2750.  
  2751.  
  2752.  
  2753.  
  2754.  
  2755.  
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.  
  2769.  
  2770.                              - vii -
  2771.  
  2772.  
  2773.